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

Behavior of implicit osv-scanner.toml when doing recursive scans #1640

Open
spencerschrock opened this issue Feb 18, 2025 · 2 comments
Open
Labels
documentation Improvements or additions to documentation

Comments

@spencerschrock
Copy link
Contributor

When configuring osv-scanner there's implicit and explicit osv-scanner.toml detection:

# Configure OSV-Scanner
To configure scanning, place an osv-scanner.toml file in the scanned file's directory. To override this osv-scanner.toml file, pass the `--config=/path/to/config.toml` flag with the path to the configuration you want to apply instead.

How is this supposed to interact with --recursive? I'm seeing the following in ossf/scorecard#4530:

implicit top-level osv-scanner.toml, with vulns in a subdirectory, still show those vulns which are ignored by the top-level config.

osv-scanner scan --recursive .
Loaded filter from: /tmp/keycloak-poc/osv-scanner.toml
╭─────────────────────────────────────┬──────┬───────────┬────────────────────────┬──────────┬───────────────────────────────────────────────────────────────╮
│ OSV URL                             │ CVSS │ ECOSYSTEM │ PACKAGE                │ VERSION  │ SOURCE                                                        │
├─────────────────────────────────────┼──────┼───────────┼────────────────────────┼──────────┼───────────────────────────────────────────────────────────────┤
│ https://osv.dev/GHSA-rc2q-x9mf-w3vf │ 7.8  │ Maven     │ org.testng:testng      │ 7.5      │ distribution/maven-plugins/pom.xml                            │
│ https://osv.dev/GHSA-9mvj-f7w8-pvh2 │ 6.4  │ npm       │ bootstrap              │ 3.4.1    │ js/pnpm-lock.yaml                                             │
│ https://osv.dev/GHSA-67mh-4wv8-2f99 │ 5.3  │ npm       │ esbuild                │ 0.23.1   │ js/pnpm-lock.yaml                                             │
│ https://osv.dev/GHSA-67mh-4wv8-2f99 │ 5.3  │ npm       │ esbuild                │ 0.24.2   │ js/pnpm-lock.yaml                                             │
│ https://osv.dev/GHSA-gxr4-xjj5-5px2 │ 6.9  │ npm       │ jquery                 │ 3.4.1    │ js/pnpm-lock.yaml                                             │
│ https://osv.dev/GHSA-jpcq-cgw6-v4j6 │ 6.9  │ npm       │ jquery                 │ 3.4.1    │ js/pnpm-lock.yaml                                             │
│ https://osv.dev/GHSA-5mg8-w23w-74h3 │ 3.3  │ Maven     │ com.google.guava:guava │ 31.1-jre │ testsuite/integration-arquillian/tests/other/webauthn/pom.xml │
│ https://osv.dev/GHSA-7g45-4rm6-3mm3 │ 5.5  │ Maven     │ com.google.guava:guava │ 31.1-jre │ testsuite/integration-arquillian/tests/other/webauthn/pom.xml │
│ https://osv.dev/GHSA-78wr-2p64-hpwj │ 8.7  │ Maven     │ commons-io:commons-io  │ 2.11.0   │ testsuite/integration-arquillian/tests/other/webauthn/pom.xml │
╰─────────────────────────────────────┴──────┴───────────┴────────────────────────┴──────────┴───────────────────────────────────────────────────────────────╯

When --config osv-scanner.toml is provided, the manually specified top-level config is applied to all subdirectories and they're all ignored

osv-scanner scan --config osv-scanner.toml -r .
CVE-2022-4065 and 1 alias have been filtered out because: reason
CVE-2024-6484 and 1 alias have been filtered out because: reason
GHSA-67mh-4wv8-2f99 has been filtered out because: reason
GHSA-67mh-4wv8-2f99 has been filtered out because: reason
CVE-2020-11022 and 2 aliases have been filtered out because: reason
CVE-2020-11023 and 2 aliases have been filtered out because: reason
CVE-2020-8908 and 2 aliases have been filtered out because: reason
CVE-2023-2976 and 2 aliases have been filtered out because: reason
CVE-2024-47554 and 1 alias have been filtered out because: reason
Filtered 9 vulnerabilities from output
@another-rex
Copy link
Collaborator

Yes this is the intended behavior, osv-scanner will do one of the following:

  • Use the config passed in via --config
  • Use the config in the same directory (same level) as each lockfile that it is parsing when recursively walking through a directory.

@another-rex
Copy link
Collaborator

We'll update the documentation to be clearer about this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

2 participants