-
Notifications
You must be signed in to change notification settings - Fork 14.6k
Add GHSA and OSV reference type support #20710
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
base: master
Are you sure you want to change the base?
Conversation
7ad0e36 to
5bee4a1
Compare
lib/msf/core/module/module_info.rb
Outdated
| if(refs and not refs.empty?) | ||
| refs.each_index do |i| | ||
| if !(refs[i].respond_to?('[]') and refs[i].length == 2) | ||
| if !(refs[i].respond_to?('[]') and (refs[i].length == 2 || refs[i].length == 3)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it be possible to check if GHSA present then only check for three in that particular scenario?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in commit 990ed30. We added a ReferencesWithOptionalThirdElement constant to define which reference types can have 2 or 3 elements, and updated the validation logic to check if a reference type is in this list before allowing 3 elements. This makes the code extensible for future reference types that may need an optional third element.
The validation now only checks for 3 elements when the reference type is GHSA (or other types added to the constant), as shown in lines 81-83:
ref_type = refs[i][0]
can_have_third_element = ReferencesWithOptionalThirdElement.include?(ref_type)
valid_length = can_have_third_element ? (refs[i].length == 2 || refs[i].length == 3) : (refs[i].length == 2)9f1642e to
990ed30
Compare
…1 modules with correct repo-specific URLs
…eference types (e.g., GHSA)
990ed30 to
f677696
Compare
…ach_index + delete)
… kind_of?, early returns, Array() helper)
Adds support for GHSA (GitHub Security Advisory) and OSV (Open Source Vulnerabilities) references in Metasploit modules. Modules can now use structured reference formats instead of full URLs.
GHSA Support
The format depends on whether the GHSA is available globally or repository-specific:
['GHSA', 'xxxx-xxxx-xxxx']=>https://github.com/advisories/GHSA-xxxx-xxxx-xxxx['GHSA', 'xxxx-xxxx-xxxx', 'owner/repo']=>https://github.com/owner/repo/security/advisories/GHSA-xxxx-xxxx-xxxxOSV Support
OSV (Open Source Vulnerabilities) is a modern vulnerability database created by Google that aggregates 15+ sources and covers 25+ ecosystems (Go, Python, npm, Maven, RubyGems, GitHub advisories, and more). It provides a unified format for open source vulnerabilities.
['OSV', 'ECOSYSTEM-YEAR-ID']=>https://osv.dev/vulnerability/ECOSYSTEM-YEAR-ID['OSV', 'GO-2021-0113'],['OSV', 'PYSEC-2024-123'],['OSV', 'GHSA-8c52-x9w7-vc95']This PR also:
TypeError