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.
Blocked patterns (silently stripped)
Section titled “Blocked patterns (silently stripped)”These regex patterns are removed from the CSS before storage. The save succeeds, but the matching substring is not stored.
| pattern | reason |
|---|---|
expression\s*\( | CSS expression() is IE-only and an XSS vector. |
javascript\s*: | JavaScript URLs are XSS vectors. |
@import\b | External CSS imports leak data and bypass CSP. |
@charset\b | Cannot 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>"). |
Validation rules (HTTP 422)
Section titled “Validation rules (HTTP 422)”These rules trigger a structured error response. The save is rejected. Fix the violation and retry.
| code | severity | description |
|---|---|---|
css_too_long | error | Custom CSS exceeds 10,000 character limit. |
branding_modification_attempted | error | 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_attempted | error | 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. |
Size limit
Section titled “Size limit”Maximum CSS length: 10,000 characters (raw input before sanitization). This is enforced as the css_too_long validation rule.