{"record":{"id":"425b304cd7dfb7cc","repo":"BigPizzaV3/CodexPlusPlus","slug":"theme-css-256-kib","errorCode":null,"errorMessage":"theme.css 为空或超过 256 KiB 限制","messagePattern":"theme\\.css 为空或超过 256 KiB 限制","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/codex-plus-core/src/dream_skin_package.rs","lineNumber":278,"sourceCode":"            compiled.push_str(rule.selector);\n            compiled.push_str(\" :where(button:not([class~=\\\"bg-token-foreground\\\"]), button:not([class~=\\\"bg-token-foreground\\\"]) *) {\\n\");\n            compiled.push_str(&format!(\"    color: {value} !important;\\n  }}\\n\"));\n        }\n    }\n    compiled.push_str(\"}\\n\");\n    Ok(compiled)\n}\n\n#[derive(Debug)]\nstruct SafeCssRule<'a> {\n    selector: &'a str,\n    part: &'a str,\n    declarations: Vec<(&'a str, &'a str)>,\n}\n\nfn parse_safe_css(css: &str) -> anyhow::Result<Vec<SafeCssRule<'_>>> {\n    if css.is_empty() || css.len() > CSS_LIMIT {\n        bail!(\"theme.css 为空或超过 256 KiB 限制\");\n    }\n    if css.chars().any(forbidden_css_character)\n        || css.contains(\"/*\")\n        || css.contains(\"*/\")\n        || css.contains('\\\\')\n    {\n        bail!(\"theme.css 包含不允许的控制字符、注释或转义\");\n    }\n    let allowed_parts = [\n        \"root\",\n        \"sidebar\",\n        \"main\",\n        \"header\",\n        \"home\",\n        \"home-hero\",\n        \"project-list\",\n        \"thread\",\n        \"message\",","sourceCodeStart":260,"sourceCodeEnd":296,"githubUrl":"https://github.com/BigPizzaV3/CodexPlusPlus/blob/f2074595a281bc057525c748175c8eb9805b0673/crates/codex-plus-core/src/dream_skin_package.rs#L260-L296","documentation":"Thrown by parse_safe_css when the theme.css payload is empty or larger than CSS_LIMIT (256 KiB). parse_safe_css is the strict Safe CSS pre-parser for Dream Skin packages, so this fires before any rule parsing happens — a coarse size/emptiness gate on the raw css string extracted from the package. The offending input is the theme.css content itself.","triggerScenarios":"Thrown at crates/codex-plus-core/src/dream_skin_package.rs:278 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Provide a non-empty theme.css with at least one rule","Reduce the stylesheet to under 256 KiB"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"f2074595a281bc057525c748175c8eb9805b0673","analyzedAt":"2026-08-23T12:52:24.489Z","contentChangedAt":"2026-08-23T12:52:24.489Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}