CVE-2026-53878: Python Regex Validation Newline Bypass

Constructing a regular expression using `$` to anchor the end can result in validation bypasses. In Python's `re` module, `$` matches the absolute end of the string OR just before a newline at the end. If this regex is used to validate input which is later embedded into a different context (like HTTP headers), it could permit newline injection. Use `\Z` inst

Provally CuratedPublic repositoryMediumMedium confidenceVerifiedApache-2.0Python
greprules fetch cve-2026-53878-python-regex-validation-newline-bypass --engine opengrep

Description

Constructing a regular expression using `$` to anchor the end can result in validation bypasses. In Python's `re` module, `$` matches the absolute end of the string OR just before a newline at the end. If this regex is used to validate input which is later embedded into a different context (like HTTP headers), it could permit newline injection. Use `\Z` inst