Use com.google.re2j.Pattern for regex matching#116
Merged
etiennehomer merged 1 commit intomainfrom Jul 17, 2025
Merged
Conversation
Signed-off-by: Etienne Homer <etiennehomer@gmail.com>
|
antoinebhs
approved these changes
Jul 17, 2025
Collaborator
antoinebhs
left a comment
There was a problem hiding this comment.
Consistent with powsybl implementation powsybl/powsybl-core@72f79de
dbraquart
pushed a commit
that referenced
this pull request
Jul 18, 2025
Signed-off-by: Etienne Homer <etiennehomer@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Please check if the PR fulfills these requirements
Does this PR already have an issue describing the problem?
Sonar security issue: "Change this code to not construct the regular expression from user-controlled data."
https://sonarcloud.io/project/issues?impactSoftwareQualities=SECURITY&issueStatuses=OPEN%2CCONFIRMED&id=com.powsybl%3Apowsybl-case-server&open=AZeCKPshG0-VpRsyXwuX
What kind of change does this PR introduce?
Fix high level security issue.
What is the current behavior?
A regex can be given through the endpoint and executed by java.util.regex.Pattern. This can lead to backtracking issues.
What is the new behavior (if this is a feature change)?
We now use com.google.re2j.Pattern to execute the regex. This lib prevents from regular expression denial of service. See powsybl/powsybl-core@72f79de
Does this PR introduce a breaking change or deprecate an API?