Skip to content

Validate uploaded BOMs against CycloneDX schema - #3522

Merged
nscuro merged 1 commit into
DependencyTrack:masterfrom
nscuro:issue-3218
Mar 10, 2024
Merged

nscuro merged 1 commit into
DependencyTrack:masterfrom
nscuro:issue-3218

Conversation

@nscuro

@nscuro nscuro commented Mar 3, 2024 •

Copy link
Copy Markdown
Member

Description

Adds validation of uploaded BOMs against the CycloneDX schema.

Automatically detects the format and spec version of the uploaded BOM, and picks a matching schema to validate against.

Validation is enabled per default, for both BOMs and VEXs.

Users who find their uploads being rejected unexpectedly can pass the environment variable BOM_VALIDATION_ENABLED=false to disable validation. Because Dependency-Track did not validate BOMs before, it is possible that users are currently uploading invalid files without knowing.

Addressed Issue

Closes #3218

Additional Details

To communicate errors during BOM validation back to clients, responses are returned in RFC 9457 format.

Example:

{
    "status": 400,
    "title": "The uploaded BOM is invalid",
    "detail": "Schema validation failed",
    "errors": [
        "cvc-complex-type.4: Attribute 'tagId' must appear on element 'swid'."
    ]
}

Frontend PR: DependencyTrack/frontend#762

Checklist

  • I have read and understand the contributing guidelines
  • This PR fixes a defect, and I have provided tests to verify that the fix is effective
  • This PR implements an enhancement, and I have provided tests to verify that it works as intended
  • This PR introduces changes to the database model, and I have added corresponding update logic
  • This PR introduces new or alters existing behavior, and I have updated the documentation accordingly

@nscuro nscuro added the enhancement New feature or request label Mar 3, 2024
@nscuro nscuro added this to the 4.11 milestone Mar 3, 2024
@nscuro
nscuro marked this pull request as draft March 3, 2024 17:36
@codacy-production

codacy-production Bot commented Mar 3, 2024 •

Copy link
Copy Markdown

Coverage summary from Codacy

See diff coverage on Codacy

Coverage variation Diff coverage
✅ +0.15% (target: -1.00%) ✅ 81.94% (target: 70.00%)
Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (f8a6a0c) 21360 15775 73.85%
Head commit (bd28ebe) 21503 (+143) 15913 (+138) 74.00% (+0.15%)

Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: <coverage of head commit> - <coverage of common ancestor commit>

Diff coverage details
Coverable lines Covered lines Diff coverage
Pull request (#3522) 144 118 81.94%

Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: <covered lines added or modified>/<coverable lines added or modified> * 100%

See your quality gate settings    Change summary preferences

You may notice some variations in coverage metrics with the latest Coverage engine update. For more details, visit the documentation

@nscuro
nscuro force-pushed the issue-3218 branch 2 times, most recently from 1f27b23 to a915d15 Compare March 4, 2024 21:46
@nscuro
nscuro marked this pull request as ready for review March 4, 2024 21:47
@nscuro
nscuro force-pushed the issue-3218 branch 3 times, most recently from fc7cb33 to 82ffe5e Compare March 10, 2024 17:49
@nscuro
nscuro merged commit 4d63c2b into DependencyTrack:master Mar 10, 2024
@nscuro
nscuro deleted the issue-3218 branch March 10, 2024 19:37
@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Apr 10, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Validate uploaded BOMs against CycloneDX schema

1 participant