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

Ingest metadata.tools and make it available in CEL policies #588

Merged
merged 1 commit into from
Feb 29, 2024
Merged

Conversation

nscuro
Copy link
Member

@nscuro nscuro commented Feb 19, 2024

Description

Ingests metadata.tools from uploaded BOMs and makes it available in CEL policies.

Addressed Issue

Closes DependencyTrack/hyades#1058

Additional Details

The internal model is aligned with CycloneDX v1.5, in that it differentiates between tools that are components, and tools that are services: https://cyclonedx.org/docs/1.5/json/#tab-pane_metadata_tools_oneOf_i0

When ingesting BOMs following v1.4 or older of the CycloneDX specification, metadata.tools array items will be converted to metadata.tools.components.

For the time being, tools are persisted as JSON column in the PROJECT_METADATA table. As such, tools will not be analyzed for vulnerabilities or other kinds of risk.

Tool components and services are treated as subsets of the internal Component and ServiceComponent models. This subset property is enforced via Jackson's @JsonViews, such that only specific fields are considered when serializing and deserializing to and from JSON.

Tools are made available in CEL policy expressions under project.metadata.tools.components. Tool components use the existing v1.Component type, which means that functions like matches_version can be used on them.

Example:

project.metadata.tools.components.exists(tool,
    tool.name == "toolName" && tool.matches_range("vers:generic/>=1.2.3|<3"))

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 Feb 19, 2024
@nscuro nscuro added this to the 5.4.0 milestone Feb 19, 2024
@nscuro nscuro force-pushed the issue-1058 branch 7 times, most recently from ff16c8d to 87adcca Compare February 22, 2024 15:16
@nscuro nscuro marked this pull request as ready for review February 22, 2024 15:18
VithikaS
VithikaS previously approved these changes Feb 28, 2024
VithikaS
VithikaS previously approved these changes Feb 28, 2024
The internal model is aligned with CycloneDX v1.5, in that it differentiates between tools that are components, and tools that are services: https://cyclonedx.org/docs/1.5/json/#tab-pane_metadata_tools_oneOf_i0

When ingesting BOMs following v1.4 or older of the CycloneDX specification, `metadata.tools` array items will be converted to `metadata.tools.components`.

For the time being, tools are persisted as JSON column in the `PROJECT_METADATA` table. As such, tools will not be analyzed for vulnerabilities or other kinds of risk.

Tool components and services are treated as subsets of the internal `Component` and `ServiceComponent` models. This subset property is enforced via Jackson's `@JsonView`s, such that only specific fields are considered when serializing and deserializing to and from JSON.

Tools are made available in CEL policy expressions under `project.metadata.tools.components`. Tool components use the existing `v1.Component` type, which means that functions like `matches_version` can be used on them.

Signed-off-by: nscuro <[email protected]>
@nscuro nscuro merged commit 101b84b into main Feb 29, 2024
6 checks passed
@nscuro nscuro deleted the issue-1058 branch February 29, 2024 14:42
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 31, 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.

Ingest tool data from metadata.tools and make it available in CEL policies
2 participants