Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@lovell
Copy link

@lovell lovell commented Sep 9, 2025

I've seen that the likelihood of ReDoS has come up a few times in this repo before and agree it's not really a major security thing, but it's one of those things that can have a negative impact on high-throughput systems.

This PR suggests a couple of possible ways to limit the effect of these.

  • Remove unnecessary whitespace before attempting more complex matching to reduce cost of backtracking.
  • Limit maximum string length to (an arbitrary) 200 characters, which would be a slightly breaking change. Perhaps this limit might need to be removable on an opt-out basis?

This is based partly on some downstream discussion at lovell/sharp#4450

Thank you for all your work continuing to maintain these colo(u)r-related packages.

- Limits maximum string length to 200 characters
- Normalizes whitespace runs to a single space character
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.

1 participant