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

Use json schema validation when processing SBOMs #808

Open
lcarva opened this issue Nov 21, 2023 · 1 comment
Open

Use json schema validation when processing SBOMs #808

lcarva opened this issue Nov 21, 2023 · 1 comment

Comments

@lcarva
Copy link
Member

lcarva commented Nov 21, 2023

When processing an SBOM, let's leverage json.match_schema to ensure the provided SBOM adheres to the expected schema.

We should do this when processing either CycloneDX or SPDX SBOMs.

Care must be taken regarding which version of the schema to be used. Consider creating a list of allowed versions and validating accordingly.

NOTE: In some cases, the schema is more lax than we'd like. For example, we have policy rules that ensure a CycloneDX SBOM provides a non-empty list of components. However, the schema does not enforce this.

Acceptance Criteria

  • SBOMs are verified against the expected JSON schema.
@lcarva
Copy link
Member Author

lcarva commented Nov 21, 2023

NOTE: After creating this story, I added some support for schema validation of CycloneDX SBOMs. It currently hard codes the version 1.5. This means that if an older version is used, or a newer one(!) , then the policy rule will cause a violation. This is ok for our current use cases, but ideally, we want to allow policy config authors to specify which schema version to check against. I'll leave this story as is to fulfill that purpose.

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

No branches or pull requests

1 participant