Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ability to ignore vulns #57

Merged
merged 16 commits into from
Aug 19, 2021
Merged

Ability to ignore vulns #57

merged 16 commits into from
Aug 19, 2021

Conversation

DarthHater
Copy link
Member

This is largely a transposition of what we do in auditjs, but I doubt it's right, so opening a PR for feedback!

This pull request makes the following changes:

  • Adds a filter_vulnerabilities to lib.rs, I didn't think this fully merited a huge implementation quite yet
  • Uses the json structure from auditjs which is:
{
  "ignore": [
    { 
      "id": "e3f310ed-219c-4087-aa58-8425b13c3ec5", 
      "reason": "postcss @ 7.x all have this vulnerability, and many dependencies require v7.x, so ignoring for now." 
    }
  ]
}
  • Adds an ignore_file param for pants

It relates to the following issue #s:

src/bin/pants/cli.rs Outdated Show resolved Hide resolved
src/lib.rs Outdated

pub fn filter_vulnerabilities(packages: &mut Vec<Coordinate>, exclude_vuln_file_path: String) {
let filter_list_str = fs::read_to_string(exclude_vuln_file_path).expect("Unable to read file");
let filter_list_json: FilterList = serde_json::from_str(&filter_list_str).expect("JSON was not well formatted");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would probably be a good idea to do something like this serde example which uses from_reader with a BufReader to stream the data from disk directly to the parser. It will be slightly more performant

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In: 546bb80

@amy-keibler
Copy link
Contributor

Uses the json structure from auditjs

Much of the rust ecosystem uses TOML rather than JSON. Are we expecting to have cross-over with auditjs for ignore files? I think we should see if we can support both JSON and TOML if serde will give it to us for free

@DarthHater
Copy link
Member Author

@amy-keibler not so much crossover, but just like, keeping it common amongst the tools. It's different in Nancy, however, so who knows 🤷

@amy-keibler
Copy link
Contributor

Do they only filter by the UUID or is there a more user-facing way to build up the filter file? (I'm not super familiar with the way we specify vulnerabilities yet, so I added a dbg!() to get the UUID of the one for time in our current project

@DarthHater
Copy link
Member Author

@amy-keibler in nancy we allowed filtering by title, but auditjs we only do uuid (which I suspect is reasonable, as long as we output it, whichhhh I should do in this too).

src/lib.rs Outdated Show resolved Hide resolved
src/lib.rs Show resolved Hide resolved
@DarthHater DarthHater marked this pull request as ready for review August 19, 2021 23:26
@DarthHater DarthHater merged commit d6a4745 into main Aug 19, 2021
@DarthHater DarthHater deleted the IgnoreVulns branch August 19, 2021 23:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support a .pants-ignore file (similar to how Nancy does it).
3 participants