BomLink accepts non-positive BOM versions and non-canonical shorthand UUIDs
Maintainers usually reply within 2 days
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 76/100
Research direction
Start in src/main/java/org/cyclonedx/util/BomLink.java, where the BomLink(String) constructor parses the serial number and version, and where isBomLink checks the urn:cdx prefix. Run the repro from the issue against master to confirm the three true results. The schema pattern in src/main/resources/bom-1.7.schema.json shows the rules to match. Done means the constructor throws BomLinkException and isBomLink returns false for version 0, negative versions and non-36-character UUIDs, and existing tests still pass.
Written by the indexing model from the issue text.
Description
BomLink and BomLink.isBomLink accept urn:cdx: URNs with zero or negative BOM versions (/0, /-5) and non-36-character shorthand UUIDs (1-1-1-1-1), disagreeing with the urn:cdx specification and CycloneDX's bomLinkDocumentType / bomLinkElementType schema definitions. Because fields such as vulnerabilities[].affects[].ref and externalReferences[].url union bomLink with refLinkType or iri-reference/xs:anyURI, schema validation lets malformed urn:cdx: strings through and callers rely on BomLink.isBomLink to distinguish valid BOM-Links.
cat > Repro.java <<'EOF'
import org.cyclonedx.util.BomLink;
public class Repro {
public static void main(String[] args) {
boolean v0 = BomLink.isBomLink("urn:cdx:3e671687-395b-41f5-a30f-a58921a69b79/0");
boolean vNeg = BomLink.isBomLink("urn:cdx:3e671687-395b-41f5-a30f-a58921a69b79/-5");
boolean shortUuid = BomLink.isBomLink("urn:cdx:1-1-1-1-1/1");
System.out.println("v0=" + v0 + " vNeg=" + vNeg + " shortUuid=" + shortUuid);
}
}
EOF
curl -fsSLO https://repo1.maven.org/maven2/org/cyclonedx/cyclonedx-core-java/13.5.0/cyclonedx-core-java-13.5.0.jar
javac -cp cyclonedx-core-java-13.5.0.jar Repro.java
java -cp .:cyclonedx-core-java-13.5.0.jar Repro
Actual output:
v0=true vNeg=true shortUuid=true
Expected v0=false vNeg=false shortUuid=false (and BomLinkException from new BomLink(...)), matching the IANA urn:cdx registration referenced in BomLink's Javadoc (bom-version >= 1 and 36-character RFC 9562 UUID) and bomLinkDocumentType / bomLinkElementType (^urn:cdx:[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/[1-9][0-9]*) in src/main/resources/bom-1.7.schema.json.
Verified on master (e591b11c6aaba7fa9cc859a9e9badfe3e1dd4cad, 13.6.0-SNAPSHOT) on Linux x86_64; BomLink.java is unchanged in release 13.5.0.
In src/main/java/org/cyclonedx/util/BomLink.java, BomLink(String) parses the serial number and version via UUID.fromString(...) and Integer.parseInt(parts[1]) without checking canonical 36-character UUID syntax or version >= 1.
Credit: https://ucsbplse.github.io/
- Dominant language
- Java
- Stars
- 124
- Forks
- 97
- Avg merge
- 2d 14h
- Merged PRs (30d)
- 11
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from CycloneDX/cyclonedx-core-java
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
CycloneDX/cyclonedx-core-java#1001 ·
Maintainers usually reply within 2 days
-
`license-mapping.json` maps classpath-exception license names to the deprecated SPDX id `GPL-2.0-with-classpath-exception`Possibly taken @afalhambra-hivemq claimed this 5 days ago. Open
Difficulty 4/5 3-5 days Newbie friendliness 35/100
CycloneDX/cyclonedx-core-java#998 ·
Maintainers usually reply within 2 days
-
Difficulty 3/5 1-2 days Newbie friendliness 55/100
CycloneDX/cyclonedx-core-java#902 ·
Maintainers usually reply within 2 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 58/100
CycloneDX/cyclonedx-core-java#848 ·
Maintainers usually reply within 2 days
-
Difficulty 5/5 Over a week Newbie friendliness 38/100
CycloneDX/cyclonedx-core-java#838 ·
Maintainers usually reply within 2 days
All issues in CycloneDX/cyclonedx-core-java
Similar issues
-
crash
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
Modern `HttpServletMcpTransport` does not check `Mcp-Name` when `params.name` or `params.uri` is not a JSON stringPossibly taken @starryeye claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
modelcontextprotocol/java-sdk#1352 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
-
account bug course exam iris lecture
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day