feat(scanner): add pylock.toml detection (PEP 751)#2548
Merged
Conversation
64f9d65 to
58c8f68
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
Adds support in Vuls’ scanner to detect and parse Python PEP 751 pylock.toml lockfiles (including pylock.<identifier>.toml variants) by wiring in Trivy v0.70.0’s pylock parser, and updates integration/golden fixtures to exercise the new path.
Changes:
- Add
pylock.toml+pylock.<identifier>.tomldetection in the scanner dispatch logic and route to a newpylockparser type. - Wire Trivy’s
python/pylockdependency parser intoparseByType. - Extend golden/integration tests and fixtures to include
pylock.tomlcoverage.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| scanner/dispatch.go | Adds pylock parser type, detection for pylock.toml, and support for named PEP 751 variants. |
| scanner/dispatch_test.go | Expands dispatch tests to cover canonical and named pylock variants plus invalid cases. |
| scanner/base.go | Wires Trivy’s pylock parser into the scanner’s parse dispatch. |
| scanner/analyze_golden_test.go | Adds pylock.toml fixture to the golden test matrix. |
| scanner/testdata/golden/pylock.toml.json | Introduces golden output for pylock.toml parsing results. |
| GNUmakefile | Adds pylock to integration scan target list. |
| .github/workflows/test.yml | Bumps the pinned vulsio/integration fixture SHA used in CI. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
MaineK00n
approved these changes
May 11, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
pylock.tomlfiles.pylock.tomlfilename and the named variantpylock.<identifier>.toml(non-empty identifier, no dots), matching Trivy's fanal analyzer behaviour.pyproject.toml-driven direct/indirect relationship enrichment that Trivy's pylock PostAnalyzer performs, since vuls calls the dependency parsers directly and intentionally bypasses the fanal post-analyzer framework.requests,urllib3, andjinja2in the integration pylock fixture to versions with published advisories so the end-to-end pipeline exercises real CVE detection through the new code path:requests2.31.0 — CVE-2024-35195 / GHSA-9wx4-h78v-vm56urllib32.2.1 — CVE-2024-37891 / GHSA-34jh-p97f-mpxfjinja23.1.4 — CVE-2024-56201 / GHSA-q2x7-8rv6-6q7h and CVE-2025-27516 / GHSA-cpwx-vrp4-4pq7Test plan
go test ./scanner/...passes.TestDetectParserTypecoverspylock.toml, a sub-path, the PEP 751 named variantspylock.uv.toml/pylock.dev.toml, and rejection ofpylock..toml,pylock.foo.bar.toml,my-pylock.toml, andpylock.toml.bak.TestAnalyzeLibrary_Golden/pylock.tomlparses the integration fixture into 29 PyPI packages; golden output is checked in atscanner/testdata/golden/pylock.toml.json.make buildsucceeds on the current branch.int-config.toml/int-redis-config.toml(in the bumped submodule) already include theservers.pylockpseudo-server; with the vulnerable pins above, the scan report should surface at least the four advisories listed in the Summary.🤖 Generated with Claude Code