Unsanitized user input in regular expression
- Rule ID: java_lang_regex_using_user_input
- Languages: java
- Source: regex_using_user_input.yml
Applications should avoid constructing regular expressions from user input. Regular expressions can have exponential worst-case computational complexity, allowing users to trigger this behaviour can result in excessive CPU consumption causing a regular expression denial of service (ReDoS).
❌ Avoid using untrusted or user data when building regular expressions
To skip this rule during a scan, use the following flag
bearer scan /path/to/your-project/ --skip-rule=java_lang_regex_using_user_input
To run only this rule during a scan, use the following flag
bearer scan /path/to/your-project/ --only-rule=java_lang_regex_using_user_input
Ready to take the next step? Learn more about Bearer Cloud.