Skip to content

🐛 fix(clean): decode CSS safety tokens - #730

Merged
gaborbernat merged 3 commits into
mainfrom
fix/721-css-escapes
Aug 10, 2026
Merged

🐛 fix(clean): decode CSS safety tokens#730
gaborbernat merged 3 commits into
mainfrom
fix/721-css-escapes

Conversation

@gaborbernat

@gaborbernat gaborbernat commented Aug 9, 2026

Copy link
Copy Markdown
Member

CSS escapes let active syntax survive raw-character sanitizer checks. Those checks also rejected function-like text inside inert strings and comments. 🔒

The native CSS scanner decodes escaped identifiers and URL values before comparison. It rejects malformed URL tokens and the legacy executable properties behavior and -moz-binding, respects token boundaries, and grows scheme buffers without truncation.

This branch follows #728 because rewritten style values need its final safety pass. The decoded checks close #721.

@gaborbernat gaborbernat added bug Something isn't working area:sanitizer clean() HTML sanitizer labels Aug 9, 2026
@codspeed-hq

codspeed-hq Bot commented Aug 9, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 109 untouched benchmarks
⏩ 30 skipped benchmarks1


Comparing fix/721-css-escapes (15dcafc) with main (c7193f0)

Open in CodSpeed

Footnotes

  1. 30 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@gaborbernat
gaborbernat force-pushed the fix/708-sanitizer-rewrites branch from c38f63d to 3fa4e29 Compare August 9, 2026 16:43
@gaborbernat
gaborbernat force-pushed the fix/721-css-escapes branch from cfab290 to 738b345 Compare August 9, 2026 16:43
@gaborbernat
gaborbernat force-pushed the fix/708-sanitizer-rewrites branch from 3fa4e29 to 3cd9ed0 Compare August 9, 2026 18:51
@gaborbernat
gaborbernat force-pushed the fix/721-css-escapes branch from 738b345 to 10c2e38 Compare August 9, 2026 18:52
@gaborbernat
gaborbernat force-pushed the fix/708-sanitizer-rewrites branch from 3cd9ed0 to 5fb7614 Compare August 9, 2026 18:55
@gaborbernat
gaborbernat force-pushed the fix/721-css-escapes branch 3 times, most recently from 1ebe20b to 1bbc392 Compare August 9, 2026 23:51
@gaborbernat
gaborbernat force-pushed the fix/708-sanitizer-rewrites branch from f16b49a to a602cb3 Compare August 10, 2026 00:15
@gaborbernat
gaborbernat force-pushed the fix/721-css-escapes branch 2 times, most recently from 68bac63 to f4c7b57 Compare August 10, 2026 00:18
@gaborbernat
gaborbernat marked this pull request as draft August 10, 2026 00:19
Base automatically changed from fix/708-sanitizer-rewrites to fix/738-match-cast August 10, 2026 13:10
@gaborbernat
gaborbernat marked this pull request as ready for review August 10, 2026 13:11
Base automatically changed from fix/738-match-cast to main August 10, 2026 15:45
@gaborbernat
gaborbernat force-pushed the fix/721-css-escapes branch 4 times, most recently from b076775 to 7eb54b1 Compare August 10, 2026 17:14
CSS escape obfuscation bypassed the sanitizer baseline because checks compared
raw characters. The scanner also rejected function-like text inside inert
strings and comments.

Decode CSS identifiers and URL values in native code. Reject malformed URL
tokens and legacy executable properties, and grow scheme buffers without
truncation.

Refs #721
@gaborbernat
gaborbernat merged commit 1b44017 into main Aug 10, 2026
51 checks passed
@gaborbernat
gaborbernat deleted the fix/721-css-escapes branch August 10, 2026 19:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:sanitizer clean() HTML sanitizer bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Decode CSS escapes before sanitizer safety checks

1 participant