-
-
Notifications
You must be signed in to change notification settings - Fork 598
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
Changed purl-policy validation to use 'matches()' instead of 'contains(), so RegExes can be used #2334
Conversation
Thanks for the PR @malice00! 🙌 If we change the behavior of Perhaps it would make sense to encapsulate the logic of assembling the regex pattern in a utility method, so it can be used by all conditions that support |
…pendencyTrack#2144 Signed-off-by: Roland Asmann <[email protected]>
Signed-off-by: Roland Asmann <[email protected]>
Rebased to the current master and added a utility-class for matching policyconditions that support the (NO_)MATCH operator. Updated all those policycondition checks to use the new class. |
src/main/java/org/dependencytrack/policy/CoordinatesPolicyEvaluator.java
Show resolved
Hide resolved
src/main/java/org/dependencytrack/policy/CoordinatesPolicyEvaluator.java
Show resolved
Hide resolved
src/main/java/org/dependencytrack/policy/CoordinatesPolicyEvaluator.java
Show resolved
Hide resolved
src/main/java/org/dependencytrack/policy/CoordinatesPolicyEvaluator.java
Show resolved
Hide resolved
This comment was marked as outdated.
This comment was marked as outdated.
Signed-off-by: Roland Asmann <[email protected]>
Forgot to update the @since-field in the new class... I hope the new version will be 4.8.0, otherwise it's still wrong! ;-) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, thanks @malice00! 🚀
Description
Changed purl-policy validation to use 'matches()' instead of 'contains(), so RegExes can be used
Addressed Issue
Fixes #2144
Additional Details
In order to not need any changes in the database, all values will get turned into RegExes if needed --> previous behavior was 'String contains', so the values will get '.*' both pre- and appended, unless the new value is a RegEx that already has this (although this wouldn't really make a difference) or if they use anchors ('^' for start-of-line and '$' for end-of-line).
Branch includes the changes from #2333, so it should be merged first!
Checklist