Commit 9a87e5c
Fix polynomial regular expression vulnerability in XML encoding detection (#68)
* Fix polynomial regex vulnerability in ENCODING_PATTERN
Changed the regex pattern from .* to .*? to use non-greedy matching,
preventing catastrophic backtracking on malicious input.
Added test case to validate the fix with various edge cases.
---------
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: slachiewicz <[email protected]>1 parent 303c1a2 commit 9a87e5c
File tree
2 files changed
+22
-1
lines changed- src
- main/java/org/codehaus/plexus/util/xml
- test/java/org/codehaus/plexus/util/xml
2 files changed
+22
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
597 | 597 | | |
598 | 598 | | |
599 | 599 | | |
600 | | - | |
| 600 | + | |
601 | 601 | | |
602 | 602 | | |
603 | 603 | | |
| |||
Lines changed: 21 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
261 | 261 | | |
262 | 262 | | |
263 | 263 | | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
264 | 285 | | |
0 commit comments