-
-
Notifications
You must be signed in to change notification settings - Fork 578
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
Component Hash policy condition only supports positive matches #4230
Comments
I think, while reading this file contents: ComponentHashPolicyEvaluator.java
for these lines:
Would it mean that it only adds a violation if the hash matches and not really handling any other comparison? If so, perhaps we can improve this. Hope can get some help on this case. Thank you |
I had made small changes to the code to add a logic to check operator of IS and IS_NOT as follows:
I have tested the above in my local and appears to be working. Here is the link to the whole code: ComponentHashPolicyEvaluator.java Hope to hear from Developers about this soon. Thank you |
@francislance Thanks for looking into this. Your proposed change makes sense. Separately, I think we really need to add some validation to |
Thanks @nscuro Shall I do a pull request for this? |
That would be fantastic! |
Hi @nscuro, I am re-evaluating this and would like to get your opinion if it makes sense for your to do the logic this way:
I made a mistake on how I evaluated the logic earlier so I am changing it as below. Let me know how you think about it. Then I will be updating the code and adding the automated test later on. Thank you. 🙏 ❌ earlier code:
✅ new code:
|
@francislance Actually the previous logic was correct. Violations are supposed to occur when their respective conditions match. |
I see. Edit: I have reverted to earlier described logic @nscuro Thank you 🙏 |
Current Behavior
When you create a policy for component hash (I tested Sha1 and 256) the conditions does not behave as what it implies to be.
Steps to Reproduce
{ "operator": "IS_NOT", "subject": "COMPONENT_HASH", "value": "{\"algorithm\":\"SHA-1\",\"value\":\"e1166b586cf9ca990ede7f3329853c0fe3547aa9\"}", "uuid": "5ad3139e-6f19-492a-b4ea-403d10a95a14" }
Observation:
Expected Behavior
Dependency-Track Version
4.12.0
Dependency-Track Distribution
Container Image
Database Server
PostgreSQL
Database Server Version
No response
Browser
Google Chrome
Checklist
The text was updated successfully, but these errors were encountered: