Skip to content

Add support for component age policy conditions - #2419

Merged
nscuro merged 1 commit into
DependencyTrack:masterfrom
nscuro:issue-772
Feb 5, 2023
Merged

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

Conversation

@nscuro

@nscuro nscuro commented Jan 28, 2023 •

Copy link
Copy Markdown
Member

Description

This PR implements a policy condition for component age.

The age can be provided in ISO-8601 period format, e.g.:

  • P1Y: 1 year
  • P2Y3M: 2 years, 3 months
  • P7D: 7 days

Lowest allowed time unit is days. Specifying hours, minutes, or seconds is not allowed.
This limitation is enforced by Java's Period class, which is used behind the scenes.

The frontend will show a tooltip to let users know about the format.

image

Addressed Issue

Closes #772

Additional Details

We have to rely on external package repositories to provide the publish date of components.

Not all repositories support this. In particular, for Rubygems and NPM components we currently do not get the publish date.

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 commented Jan 29, 2023

Copy link
Copy Markdown
Member Author

We don't currently display the actual component age anywhere in the UI. I created DependencyTrack/frontend#399 for that.

@msymons

msymons commented Jan 30, 2023

Copy link
Copy Markdown
Member

This PR is now a wee bit more useful than it would have been just 6 months ago:

We have to rely on external package repositories to provide the publish date of components.

DT v4.7.0 introduced authentication support for internal repos. So now we have component age for everything from all our own internal projects! 😁

@nscuro
nscuro merged commit 30ed45c into DependencyTrack:master Feb 5, 2023
@nscuro
nscuro deleted the issue-772 branch February 5, 2023 17:03
@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Mar 8, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Policy: Add support for component age in policy conditions

2 participants