Skip to content
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

CPEs are case-sensitive #4663

Open
2 tasks done
DaBalt opened this issue Feb 18, 2025 · 1 comment
Open
2 tasks done

CPEs are case-sensitive #4663

DaBalt opened this issue Feb 18, 2025 · 1 comment
Labels
enhancement New feature or request p2 Non-critical bugs, and features that help organizations to identify and reduce risk size/M Medium effort

Comments

@DaBalt
Copy link

DaBalt commented Feb 18, 2025

Current Behavior

Currently when you're adding component with CPE like:

cpe:2.3:a:7-Zip:7-Zip:18.03:::::::*

The DependencyTrack analyzers will not find any issues. When switching from "Z" to "z" everything works correctly:

cpe:2.3:a:7-zip:7-zip:18.03:::::::*

Proposed Behavior

The CPE (and PURL I suppose) should be case-insensitive, all combination should find vulnerabilities.

Checklist

@DaBalt DaBalt added the enhancement New feature or request label Feb 18, 2025
@nscuro nscuro added p2 Non-critical bugs, and features that help organizations to identify and reduce risk size/M Medium effort labels Feb 19, 2025
@nscuro
Copy link
Member

nscuro commented Feb 19, 2025

Note, we aware of this gap:

if (!"*".equals(cpePart) && !"-".equals(cpePart)) {
// | No. | Source A-V | Target A-V | Relation |
// | :-- | :-------------- | :--------- | :------------------- |
// | 3 | ANY | i | SUPERSET |
// | 7 | NA | i | DISJOINT |
// | 9 | i | i | EQUAL |
// | 10 | i | k | DISJOINT |
// | 14 | m1 + wild cards | m2 | SUPERSET or DISJOINT |
// TODO: Filter should use equalsIgnoreCase as CPE matching is case-insensitive.
// Can't currently do this as it would require an index on UPPER("PART"),
// which we cannot add through JDO annotations.
cpeQueryFilterParts.add("(part == '*' || part == :part)");
queryParams.put("part", cpePart);

It currently affects the part, vendor, and product portions of CPEs.

Since we can't currently apply indexes on expressions (i.e. lower(part) or upper(part)), an alternative could be to migrate all existing values in the database to lowercase, and only populate it with lowercased values going forward.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request p2 Non-critical bugs, and features that help organizations to identify and reduce risk size/M Medium effort
Projects
None yet
Development

No branches or pull requests

2 participants