Skip to content

fix(fp): convert hosted/generated suppressions to conservative regex prefix matchers#8522

Merged
jeremylong merged 1 commit into
dependency-check:generatedSuppressionsfrom
chadlwilson:generatedSuppressions-improve-conservative-matching
May 20, 2026
Merged

fix(fp): convert hosted/generated suppressions to conservative regex prefix matchers#8522
jeremylong merged 1 commit into
dependency-check:generatedSuppressionsfrom
chadlwilson:generatedSuppressions-improve-conservative-matching

Conversation

@chadlwilson
Copy link
Copy Markdown
Collaborator

@chadlwilson chadlwilson commented May 20, 2026

Description of Change

As discovered myself in #8521 (comment) unfortunately my change in #8510 caused some unintentional regression of suppression applicability for hosted suppressions, since the trailing bits of the CPE are removed for vulnerabilities without versions in them (typically ones with startsWith/endsWith ranges at NVD such as https://nvd.nist.gov/vuln/detail/CVE-2025-15104)

image

The existing code does not normalise the suppression rule CPE URI from the suppressions before comparing the string representation prefix. This means vulns with affected versions like cpe:2.3:a:validator:validator:*:*:*:*:*:* will no longer match as they are correctly normalized by the code to cpe:/a:validator:validator without a trailing : before matching to the prefix rule. I'd forgotten about this CPE 2.2 vs 2.3 difference :-(

This change converts them to regexes - so it's possible to express the matching across ODC versions. An alternative would be to just revert things and leave the false negative possibilities.

  • It's probably not great (complexity, readability, performance) to have to do regex matching everywhere here, however since hosted suppressions are supported across older versions, the alternative would leave us stuck without consistent conservative matching, as requires code change to fix.
  • Happy to take feedback though - WDYT @jeremylong @marcelstoer?
  • I'll follow up with a "fix" of some sort on master as well once we've agreed approach; to improve the non-regex matching; and/or to improve the regex matching speed.

Related issues

Have test cases been added to cover the new functionality?

no

…prefix matchers

Unfortunately, dependency-check#8510 caused some suppressions to regress, since the trailing bits of the CPE are removed for vulnerabilities without versions in them and the
existing code does not normalise the CPE URI from the suppressions. This means vulns with affected versions like `cpe:2.3:a:vaadin:vaadin:*:*:*:*:*:*` will no
longer match as they are normalized to `cpe:/a:vaadin:vaadin` without a trailing `:`

Signed-off-by: Chad Wilson <29788154+chadlwilson@users.noreply.github.com>
@chadlwilson
Copy link
Copy Markdown
Collaborator Author

Sorry forgot to tag @nhumblot for feedback 🙏🏻

We might get a swathe of FP reports today because of my mistake here. I'll handle them if so.

Copy link
Copy Markdown
Collaborator

@jeremylong jeremylong left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@jeremylong jeremylong merged commit fd39162 into dependency-check:generatedSuppressions May 20, 2026
7 checks passed
@jeremylong jeremylong added this to the 13.0.0 milestone May 20, 2026
@chadlwilson chadlwilson deleted the generatedSuppressions-improve-conservative-matching branch May 20, 2026 10:29
@chadlwilson
Copy link
Copy Markdown
Collaborator Author

Sorry for the hassle. 😓

@chadlwilson
Copy link
Copy Markdown
Collaborator Author

chadlwilson commented May 20, 2026

@jeremylong unfortunately #8516 didn’t seem to lead to the publish workflow being triggered.

https://github.com/dependency-check/DependencyCheck/actions?query=workflow%3A%22Publish%20Suppressions%22

would you be able to trigger the workflow manually for now so we can get the fix out?

@ArkanEPITA
Copy link
Copy Markdown

Hello,

Since the new way of handling the packageUrl with regex, the matching seems to be incrorrect. The package "pkg:maven/org.hibernate.validator/hibernate-validator@8.0.2.Final" should be matched by the following suppression in the generatedSuppression file:

<suppress base="true">
    <notes><![CDATA[
    FP per issue #8243, #8244, #8247, #8249
    ]]></notes>
    <packageUrl regex="true">^pkg:(?!maven/nu\.validator/validator@|npm/vnu-jar)(:.*)?$</packageUrl>
    <cpe regex="true">cpe:/a:validator:validator(:.*)?$</cpe>
</suppress>

Yet, the CVE-2025-15104 still fails the check.

The packageUrl regex changed from ^pkg:(?!maven/nu\.validator/validator@|npm/vnu-jar).* to ^pkg(?!:maven\/nu\.validator\/validator@|npm\/vnu-jar)(:.*)?$ here

Other package url doesnt seem to be touched (I didnt check each of them though).

Reading the comment on this issue and the linked one, I don't know why pkgUrl matching changed as the topic seems to be around cpe matching. Is it an oversight ?

  • AFAIK, the package URL spec doesnt specify multiple "semi-colon followed by char" sequences and only a semi-colon after the pkg scheme. So I don't know what this commit tried to achieve there.

@chadlwilson
Copy link
Copy Markdown
Collaborator Author

chadlwilson commented May 20, 2026

See #8525 for the fix (already linked above) - apologies for the hassle.

@chadlwilson
Copy link
Copy Markdown
Collaborator Author

None of these suppression rules have any automated tests whatsoever, so occasionally screw ups will happen, unfortunately (including systemic issues such as the widespread false negatives that this PR and #8510 are attempting to fix for the <cpe> matchers)

@chadlwilson
Copy link
Copy Markdown
Collaborator Author

Copilot would probably have caught this, but I forgot to ask it for review. Oops.

@ArkanEPITA
Copy link
Copy Markdown

Right ! Have not seen that, thanks a lot :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants