fix(analyzer): detect OpenSSL 3.x in OpenSSLAnalyzer#8484
Open
shawnjohnjr wants to merge 1 commit into
Open
Conversation
OpenSSL 3.x defines OPENSSL_VERSION_NUMBER as a macro expression rather than a literal hex constant, so the existing regex never matches and the analyzer drops the dependency. As a result, 3.x source trees produce no CPE and never match NVD CVEs. Add a second pattern that captures OPENSSL_VERSION_STR "X.Y.Z" (introduced in 3.0); fall back to the legacy NUMBER pattern for 1.x and earlier. Adds a test fixture/case using opensslv.h from OpenSSL 3.5.6.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates OpenSSLAnalyzer so it can correctly extract versions from OpenSSL 3.x source headers, where OPENSSL_VERSION_NUMBER is no longer a literal hex constant and therefore doesn’t match the legacy regex. This ensures OpenSSL 3.x scans produce version evidence and identifiers (e.g., CPE/PURL), enabling NVD CVE matching.
Changes:
- Add detection for OpenSSL 3.x by parsing
OPENSSL_VERSION_STR "X.Y.Z"before falling back to the legacyOPENSSL_VERSION_NUMBERpattern. - Add an OpenSSL 3.5.6
opensslv.htest fixture undercoretest resources. - Add a new unit test asserting
3.5.6is extracted from the OpenSSL 3.x header.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| core/src/main/java/org/owasp/dependencycheck/analyzer/OpenSSLAnalyzer.java | Adds a new regex path to extract OpenSSL 3.x versions via OPENSSL_VERSION_STR, preserving the existing 1.x detection fallback. |
| core/src/test/java/org/owasp/dependencycheck/analyzer/OpenSSLAnalyzerTest.java | Adds a unit test covering OpenSSL 3.x header parsing (3.5.6). |
| core/src/test/resources/openssl-3x/opensslv.h | Introduces a real-world OpenSSL 3.5.6 opensslv.h fixture for regression coverage. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Collaborator
|
This analyzer is super curious to me given how specific it is. I wonder how many people use it - are you a user? 😅 |
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
OpenSSLAnalyzercannot detect OpenSSL 3.x sources today: 3.x definesOPENSSL_VERSION_NUMBERas a macro expression (not a literal hex constant), the existing regex never matches, and the dependency is dropped viaengine.removeDependency(). As a result a scan over an OpenSSL 3.x source tree produces no CPE and never matches NVD CVEs.OPENSSL_VERSION_STR "X.Y.Z"(introduced in OpenSSL 3.0) and tries it before falling back to the legacyOPENSSL_VERSION_NUMBERhex pattern, so 1.x detection is preserved.core/src/test/resources/openssl-3x/opensslv.hfrom OpenSSL 3.5.6) and a parallel test case asserting3.5.6is extracted.Reproducer (before this change)
Scan an OpenSSL 3.5.6 source tree:
The resulting JSON has no dependency for
opensslv.hand nocpe:2.3:a:openssl:openssl:3.5.6:*identifier. After this change the same scan produces:Test plan
mvn -pl core -am test -Dtest=OpenSSLAnalyzerTest -Dsurefire.failIfNoSpecifiedTests=false— 5/5 pass (existing 4 + newtestOpenSSL3xVersionHeaderFile)cpe:2.3:a:openssl:openssl:3.5.6is now attached to theopensslv.hdependency