-
-
Notifications
You must be signed in to change notification settings - Fork 598
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
Composer Repository Vulnerability Mirroring #4515
base: master
Are you sure you want to change the base?
Composer Repository Vulnerability Mirroring #4515
Conversation
@nscuro It's still in draft as I need to add docs, testcases and some cleanup. Would you be able to look at the overall approach taken? |
e2fab37
to
6489de1
Compare
There's one thing specifically I need feedback on. It is on how to handle advisories from Composer repositories that are really just a mirror of a CVE or GHSA. Composer, or more specific packagist.org, is merely just a vulnerability aggregator similar to OSV. It aggregates CVEs and GHSAs. But also vulnerabilities from other sources such as FriendsofPHP. This means a lot of advisories look like this:
Which currently leads to DT creating a new vulnerability with Id I am wondering if this is the best approach? Osv has similar situation, but they do not put their own Id on these vulnerabilities. They use the CVE or GHSA is Id for their advisories. And DT then does not create a new vulnerability (unless NVD or GHSA mirroring is disabled/lagging behind). Should we do the same for these Composer advisories? Or should I just accept that DT is not (yet) good at deduplicating aliases and just add a new vulnerability with PKSA Id? The idea is that VulnerableSoftware and AffectedVersionAttribution (and aliases) should still be synced for these vulnerabilities. BTW After writing this comment I checked the advisories of packagist.org and it looks like all of them have at least a CVE or GHSA. I believe this is relatively new and it looks like GHSA has started to create advisories for all vulnerabilities of FriendsofPHP. So why enable Packagist advisory sync at all, just for the attribution part? For other repositories like Drupal8 the mirroring is still valid as they provide their own vulnerabilities in their feed (SA-CORE-xxxx, SA-CONTRIB-yyyy). There maybe more repositories in the future, such as for Magento, Shopware, ... This question about whether or not to "duplicate" all the CVE/GHSA vulnerabilities applies to more future vulnerability sources, for example Wordfence or WPScan. These are also aggregating from other sources. But they also add their own vulnerabilities to their feed. At some point you may have 5-6 aliases per vulnerability. |
Coverage summary from CodacySee diff coverage on Codacy
Coverage variation details
Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: Diff coverage details
Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: See your quality gate settings Change summary preferencesCodacy stopped sending the deprecated coverage status on June 5th, 2024. Learn more |
e392719
to
976bafa
Compare
d2917df
to
e7a8de6
Compare
e222894
to
381634c
Compare
Signed-off-by: Valentijn Scholten <[email protected]>
381634c
to
daa81e3
Compare
Did not yet have an answer to my question above, but went ahead and finsihed the implementation and test cases. Vulnerabilities that have a GHSA or CVE are not replicated, we only set the affected version attribution. Updated the description of the PR with the implemented logic. |
For the moment, it would be best to use CVEs and GHSAs if possible. The alias design needs an overhaul to properly deal with a lot of identifiers (perhaps you have some input for #4528?). Separately, what's your impression on the mapping of those aliases you've seen so far? Do PKSA's always map to one CVE/GHSA, or can there be multiple? Could those PHP sources suffer from the same problem as google/osv.dev#888? |
It's one-on-one, also for CVEs that alias GHSA and vice versa. Just verified that with some extra checks/logging during a mirror task. Packagist also makes some effort to deduplicate things from the two sources they import from:
source: https://blog.packagist.com/discover-security-advisories-with-composers-audit-command/ |
Description
Mirrors Security Advisories from Composer Repositories.
Implementation based on / tested with:
The packagist repository provides advisories that are imported from:
So mirroring from Packagist provides little benefit, unless you have GitHub advisories disabled.
The biggest benefit is in third party repositories such as the Drupal8 repository. For some vulnerabilities (plugins/themes), this is currently the only way to get these vulnerabilities into Dependency Track. These are not tracked by Trivy/GitHub/OSV/Snyk/....
For this reason this PR introduces DRUPAL is a new SOURCE of vulnerabilities.
PACKAGIST is not added as a source as it doesn't provide new vulnerabilities and doesn't have commonly known IDs (PKSA-xxxx-yyyy).
This PR does introduce COMPOSER as a new source for Affected Version Attribution.
It mimics as mich as possible the code / behaviour of the Composer CLI. I had to up my Php reading skill to get there ;-)
Addressed Issue
Fixes #4465
Frontent companion: DependencyTrack/frontend#1130
Checklist