fr-manvi opened a new pull request, #1737: URL: https://github.com/apache/wicket/pull/1737
UrlValidator's authority regex backtracks quadratically on an authority that contains no '@': - the userinfo group `(.+(:.*)?@)?` overlaps the outer `.+` with the inner `(:.*)?`, so a value like `http://` followed by tens of thousands of colons takes tens of seconds and scales O(n^2) - `isValidAuthority` gets the authority straight from the submitted URL, and a UrlValidator normally sits on a public, often pre-auth form field, so a few requests each pin a request thread - `(:.*)?` is redundant since `.+` already matches `:`, and the group is never read, so `(.+@)?` accepts the identical set of URLs and parses the same host and port The regression test submits `http://` plus 50k colons and asserts it resolves well under a second; it times out against the old pattern and passes with the fix. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
