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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: update readme to add allowlist formats #253

Closed
wants to merge 2 commits into from

Conversation

andrewdetorres
Copy link

@andrewdetorres andrewdetorres commented May 13, 2022

PR to add allowlist formats to the README.md to help make the options available to a user more clear

Would appreciate any feedback on this PR. 馃槃

In reference to #252

Thanks,
Andrew

@andrewdetorres andrewdetorres changed the title chore: update readme to add allowlist formats docs: update readme to add allowlist formats May 13, 2022
@@ -65,6 +65,39 @@ Also, it suppresses an advisory of `axios` and a transitive advisory of `react-s
}
```

### Allowlist formats

To suppress the vulnerability associated with the an advisory. You can simply add the advisory ID to the allowlist.
Copy link
Member

Choose a reason for hiding this comment

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

This section is a great start. IMO, it leans a bit too much towards examples compared to definitions and reasoning when to use each allowlist option. The example section captures quite some of the examples you've described. Here's my attempt, let me know what you think:

Allowlisting

Allowlists are a mechanism to suppress an advisory warning from the audit. A team may want to suppress an advisory when:

  • A fix has already been started
  • There is no bandwidth to fix the advisory
  • The risk is tolerable for the project
  • The advisory is inaccurate or incorrect
  • The vulnerable code is not actually used

An allowlist may contain multiple allowlist records. There are three categories of allowlist record formats:

  • module allowlist record (example: axios, suppresses all advisories directly caused by axios, not transitive advisories)
  • advisory allowlist record (example: GHSA-42xw-2xvc-qx8m, suppresses all instances of advisory based on the GitHub advisory identifier)
  • path allowlist record (example: GHSA-rp65-9cf3-cjxr|react-scripts>@svgr/webpack>@svgr/plugin-svgo>svgo>css-select>nth-check, the specific and full advisory path with wildcard support)

When audit-ci identifies new advisories at or above the configured level, the CI pipeline will fail.

Found vulnerable advisory paths:
GHSA-pw2r-vq6v-hr8c|axios>follow-redirects
GHSA-74fj-2j2h-c42q|axios>follow-redirects
GHSA-4w2v-q235-vp99|axios
GHSA-42xw-2xvc-qx8m|axios
GHSA-cph5-m8f7-6c5x|axios
Failed security audit due to high, moderate vulnerabilities.
Vulnerable advisories are:
https://github.com/advisories/GHSA-pw2r-vq6v-hr8c
https://github.com/advisories/GHSA-74fj-2j2h-c42q
https://github.com/advisories/GHSA-4w2v-q235-vp99
https://github.com/advisories/GHSA-42xw-2xvc-qx8m
https://github.com/advisories/GHSA-cph5-m8f7-6c5x
Exiting...

Advisories can be suppressed using several approaches. Each approach is useful in unique scenarios.

First, the most granular and secure approach, using paths. If in the future the same advisory arises with a different path, the pipeline will fail.

"allowlist": [
  "GHSA-pw2r-vq6v-hr8c|axios>follow-redirects",
  "GHSA-74fj-2j2h-c42q|axios>follow-redirects",
  "GHSA-4w2v-q235-vp99|axios",
  "GHSA-42xw-2xvc-qx8m|axios",
  "GHSA-cph5-m8f7-6c5x|axios"
]

The next best approach is suppressing the advisories using advisory IDs. This approach may be useful if your team knows that the application is not (and will not be) affected by the advisory regardless of the path. Often, the same advisory can be present in many paths. Allowlisting by advisory ID is terser than the alternative of listing all paths.

"allowlist": [
  "GHSA-pw2r-vq6v-hr8c",
  "GHSA-74fj-2j2h-c42q",
  "GHSA-4w2v-q235-vp99",
  "GHSA-42xw-2xvc-qx8m",
  "GHSA-cph5-m8f7-6c5x"
]

The next approach is to allowlist the modules themselves. All current and future advisories are automatically suppressed when using module allowlist records. Compared to other suppression approaches, there's an increased risk of a new advisory impacting your application due to the broad suppression. Suppressing via a module allowlist record is often less useful than using path allowlist records + wildcards, as noted in the final approach.

"allowlist": [
  "axios",
  "follow-redirects"
]

Finally, wildcards can be used within path allowlist records. Wildcards are useful for trusted development-only dependencies such as react-scripts. Unlike the module allowlist record of react-scripts, the path allowlist of *|react-scripts>* suppresses transitive dependency advisories (dependencies of dependencies).

Wildcard matching works by:

  1. splitting the allowlist record at every wildcard
  2. constructing a regex matching anything at each wildcard location

An allowlist record may include any number of wildcards such as *|react-scripts>*>*>example>*

@quinnturner
Copy link
Member

I've opened up #254 as an alternative to this PR. It contains reasoning for when and why each approach should be used (perhaps a bit too much). I tried to ensure that what you put here was captured in some combo of my docs and the examples. I am hoping you can review my PR @andrewdetorres!

@andrewdetorres
Copy link
Author

andrewdetorres commented May 16, 2022

Looks great. Reviewed and approved new PR 馃槄
We can close this now 馃憤

@quinnturner
Copy link
Member

Thanks again @andrewdetorres :)

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.

None yet

2 participants