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
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
33 changes: 33 additions & 0 deletions README.md
Expand Up @@ -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>*


- For example, Axios denial of service (https://github.com/advisories/GHSA-42xw-2xvc-qx8m)

```jsonc
"allowlist": [
"GHSA-42xw-2xvc-qx8m",
]
```

To suppress advisories for all transitive dependencies of a given package, use this format: `"*|PACKAGE_NAME>*"`
_Note: This may allow legitimate advisories to slip through._

- For example, `react-scripts`

```jsonc
"allowlist": [
"*|react-scripts>*"
]
```

To suppress an advisory related to a transitive dependency of a given package, use the following format: `"ADVISORY_ID|PACKAGE_NAME>PACKAGE_A>PACKAGE_B"`

- For example, `nth-check` in `react-scripts`

```jsonc
"allowlist": [
"GHSA-rp65-9cf3-cjxr|react-scripts>@svgr/webpack>@svgr/plugin-svgo>svgo>css-select>nth-check"
]
```

### GitHub Actions

```yml
Expand Down