Skip to content

Conversation

ppkarwasz
Copy link
Contributor

@ppkarwasz ppkarwasz commented Jan 17, 2024

This PR is based on #2203 and should be merged after it.

It ports to main the changes in:

@ppkarwasz ppkarwasz self-assigned this Jan 23, 2024
vy and others added 3 commits January 26, 2024 10:09
We change the order in which `FormattedMessage` checks the format of the
provided pattern: we first check for the presence of `{}` placeholders
and only then for `java.util.Format` specifiers.

This eliminates the need for a potentially exponential regular
expression evalutation, which was reported by Spotbugs (apache#1849).

The Javadoc and documentation were improved to clarify the heuristic
used by `FormattedMessage`.

Closes apache#1223.

Remark: since `FormattedMessage` used the **same** regular expression as
`java.util.Format`, if a message uses `java.util.Format` specifiers, it
is still vulnerable to a ReDOS.
Ports minor changes in `log4j-api` from `2.x`.
@ppkarwasz ppkarwasz merged commit 67be357 into apache:main Jan 26, 2024
@ppkarwasz ppkarwasz deleted the sync2-api branch February 15, 2024 15:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants