Repository navigation
feat: dependency analysis and reachable vulnerabilities - #38
Merged
Merged
Conversation
5 tasks done
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
Opens Phase 9 of
docs/architecture.md: dependency analysis (§26) and the first step of the correlation of §27, "vulnerable package + affected API reachable".test: define dependency analysis behavior), implementation follows.coretrace_python.dependency:Requirement,Version(a PEP 440 subset with==,!=,<,<=,>,>=,~=and Poetry's^),DependencyGraph,Advisory(package, vulnerable range, affected APIs) and parsers forrequirements*.txt,pyproject.toml(PEP 621 and Poetry) and thepoetry.lock/uv.locklockfiles, which pin the declared requirements when merged. Nothing is downloaded. A requirement "may match" a vulnerable range when its pin is inside it, or when some version it allows is.DependencyAnalysis(dependency.graph) is an engine-provided input like the security models; a lone file sees an empty graph.advisories;ProjectPluginruns once per project with aProjectContextexposing the module graph, the dependency graph, all advisories and each module's imports and call graph.engine.analyze_projectalso accepts plugin instances directly.plugins/dependency:sample-advisories(a small offline sample of published CVEs with the APIs they affect),vulnerable-dependency(a requirement allows a vulnerable version, at its line, high confidence when pinned and medium otherwise) andreachable-vulnerability(a call anywhere in the project to an affected API of a vulnerable requirement, at the call site).dependencysits abovefindings, belowplugins.Example:
pyyaml==5.3.1inrequirements.txtplusyaml.load(text)in a module yields a criticalreachable-vulnerabilityat the call and a criticalvulnerable-dependencyat the requirement line.Not in this PR: live OSV/GHSA feeds, policy plugins, secret detection, SBOM, and the taint side of the correlation (attacker-controlled data reaching the affected API).
Part of #37