Open francislance opened 3 weeks ago
The way to handle this is to set the policy operator to ALL
and add qualifying conditions that narrow down on the components you want to assert the hash for. For example using the Coordinates
or Package URL
subjects.
With policy operator ALL
, all conditions must be met in order for a violation to be raised.
@nscuro i'll give this a try and revert back if all good. Thank you for your quick response on this.
Hi @nscuro
I did looked into this and you are right that it can be achieved.
I have observations on the behavior that I believe we can improve. As I understand this is how Policies work as of my latest testing:
ALL
of the conditions are met.Package URL
matches specific value condition - this indeed will report FAIL violationComponent Hash
with IS_NOT - this also resulted in FAIL violation.My opinion on this is item#2 above actually shouldn’t be a Condition, but rather be a Scope.
I can see that scoping is implemented already using the feature “Limit to projects/tags” however that also doesn’t limit yet the policy when it comes to special cases like hashing which definitely going to be targeting a 1 specific component.
Another defect I observed based on the use case above is that you will be reported with 2 Policy violations (both PURL and Component Hash) instead of you only checking the violation of the component hash.
Current Behavior
In further improvement related to https://github.com/DependencyTrack/dependency-track/issues/4230
I believe it is a must to set a scope limit of policies per "component" not only limit by Project.
Example in the case of creating policy for Hash values:
Steps to Reproduce
Expected Behavior
Dependency-Track Version
4.12.0
Dependency-Track Distribution
Container Image
Database Server
N/A
Database Server Version
No response
Browser
N/A
Checklist