dependency-track icon indicating copy to clipboard operation
dependency-track copied to clipboard

Split direct dependency check from Version Distance Evaluator

Open elliotsegler opened this issue 2 years ago • 3 comments

Current Behavior

Currently the Version Distance Policy Evaluator is able to check for version distance, but will only fire if the package it is assessing is a direct dependency of the object the policy is applying to.

Proposed Behavior

The test for a package being a direct dependency should probably be in it's own evaluator.

It's useful to know if, in an aggregated bom or in a project there's packages anywhere in the dependency tree that do not meet the policy thresholds (regardless of if they are direct).

An example of this is building a policy where you want the distance to be equal to 0.0.0.0, but the age at some amount of time (i.e. the latest package version is not updated in a few years).

The existing behaviour could still be used by using an ALL condition with the two policies.

Checklist

elliotsegler avatar Jan 18 '24 08:01 elliotsegler

This is the code I'm referencing: https://github.com/DependencyTrack/dependency-track/blob/026b504d27c692674eeca0bad32fcb22428b8b02/src/main/java/org/dependencytrack/policy/VersionDistancePolicyEvaluator.java#L102-L106

elliotsegler avatar Jan 18 '24 08:01 elliotsegler