Repository navigation
Fix CodeQL ReDoS and XSS alerts - #3598
Merged
Merged
Conversation
…ng test server Signed-off-by: Marvin Froeder <velo.br@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.
Fixes the four open CodeQL code-scanning alerts on
master.#14 Inefficient regular expression (
Expressions.java): inVARIABLE_LIST_PATTERN, the:.*modifier can match commas, and the repeated(,item)*group matches them too. An input like$,$:+,$:×n +\nhas exponentially many ways to split before it fails. The pattern is now "any number ofname*?,items, then a finalname(:.*|*)?", with possessive quantifiers and non-capturing groups, so each character can be matched only one way. The pattern is only used withmatches()and no groups are read.ExpressionsTest.variableListPatternDoesNotBacktrackExponentiallychecks a 100,000-repeat input within 2 s. On Java 21 the old pattern is fast too, so this test guards against future changes; the Java 8 timings above are the evidence for the fix.#17, #18, #19 Cross-site scripting (
form-springtestServer.java):upload1,upload2andupload3echo request data back without a response type, so it could be served as HTML. They now declareproduces = TEXT_PLAIN_VALUE. The Feign client sends noAcceptheader for these calls, so the tests don't change.Tests:
core741 (4 skipped),form-spring9, all passing.