Skip to content

Sanitize ANSI escape sequences in CSP report logging - #1396

Closed
5H4D0WBY73 wants to merge 3 commits into
mesop-dev:mainfrom
5H4D0WBY73:fix/ansi-escape-injection
Closed

Sanitize ANSI escape sequences in CSP report logging#1396
5H4D0WBY73 wants to merge 3 commits into
mesop-dev:mainfrom
5H4D0WBY73:fix/ansi-escape-injection

Conversation

@5H4D0WBY73

Copy link
Copy Markdown

Summary

This PR sanitizes ANSI/VT100 escape sequences from untrusted CSP report fields before they are written to the terminal.

Root Cause

The /__csp__ endpoint logs attacker-controlled values directly using print(). ANSI escape sequences were preserved and interpreted by ANSI-compatible terminals.

Fix

  • Added a helper to strip ANSI escape sequences.
  • Sanitized user-controlled CSP report fields before logging.
  • Preserves existing logging behavior for normal input.

Closes the GHSA security advisory.

@richard-to

Copy link
Copy Markdown
Collaborator

Thanks for the PR. Going to close this one in favor of #1397. Mainly just fixes some lint issues and a few other things. Thanks again.

@richard-to richard-to closed this Aug 1, 2026
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