Skip to content

Sanitizer Rules

Two categories of sanitizer rules: blocked patterns (regex-stripped silently) and validation rules (return HTTP 422 with structured error). For the full explanation of the two-layer system, see CSS Sanitizer Rules.

These regex patterns are removed from the CSS before storage. The save succeeds, but the matching substring is not stored.

patternreason
expression\s*\(CSS expression() is IE-only and an XSS vector.
javascript\s*:JavaScript URLs are XSS vectors.
@import\bExternal CSS imports leak data and bypass CSP.
@charset\bCannot change document charset from custom CSS.
behavior\s*:IE legacy behavior property is an XSS vector.
-moz-binding\s*:Firefox legacy XBL binding is an XSS vector.
url\(.*javascript:.*\)javascript: URLs in url() are XSS vectors.
url\(.*data:(?!image/).*\)Non-image data: URIs can carry executable content.
<\s*/?\s*(?:script|style)\b[^>]*>HTML script/style tags (opening or closing, with or without stray whitespace) can break out of the surrounding markup context. Applied REPEATEDLY until the result stops changing, because removing a nested tag can splice its neighbours into a new one ("<scr<script>ipt>").

These rules trigger a structured error response. The save is rejected. Fix the violation and retry.

codeseveritydescription
css_too_longerror Custom CSS exceeds 10,000 character limit.
branding_modification_attemptederror Custom CSS targets protected branding selectors (.ag-branding, .ag-cookie-mark, .ag-bite, .ag-cr1-3). See https://api.kookiok.com/docs/banner-css/branding-policy.
banner_hiding_attemptederror Custom CSS plainly hides the banner, its button row or the Reject all, Accept all or Customize button: display: none (contents on a button), an opacity under 0.5 on .ag-banner or a filter opacity() under 0.5 on a button, a scale() under 0.5 or a translate() of a screen (1000px, 100%), an offset or margin of a screen, an offset pulling the banner's edge 100px past the screen. Only the plainest values are judged. The issue lists each declaration. See https://api.kookiok.com/docs/banner-css/css-sanitizer#banner-hiding.

Maximum CSS length: 10,000 characters (raw input before sanitization). This is enforced as the css_too_long validation rule.