logging-formatter-anticrlf is a Python logging Formatter designed to prevent CRLF Injection (CWE-93 / CWE-117) by sanitizing log messages. It ensures that newline characters and other control characters are properly escaped or removed, mitigating the risk of log forging attacks. The current version is 1.2.1, and it maintains a focused feature set with stable, infrequent releases.
pip install logging-formatter-anticrlfVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to integrate `AntiCRLFFormatter` into a standard Python logging setup. It shows how to instantiate the formatter and apply it to a `StreamHandler` to sanitize log messages before they are written to the console, preventing CRLF injection.
Always pass potentially untrusted input via the message argument and its formatting arguments (e.g., `logger.info('User: %s', user_input)`). Ensure any custom formatters or handlers explicitly sanitize other log record attributes if they contain untrusted data.Combine `AntiCRLFFormatter` with a comprehensive security strategy, including robust input validation, secure system configurations, and appropriate access controls for log files and logging infrastructure.
No dependency data recorded yet.