{"record":{"id":"7ab2af0a7e8889f6","repo":"BigPizzaV3/CodexPlusPlus","slug":"id-7ab2af","errorCode":null,"errorMessage":"主题市场包含无效 ID：{}","messagePattern":"主题市场包含无效 ID：(.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/codex-plus-core/src/dream_skin_market.rs","lineNumber":205,"sourceCode":"        bail!(\"不支持的主题市场清单版本\");\n    }\n    if manifest.themes.len() > MARKET_THEME_COUNT_LIMIT {\n        bail!(\"主题市场清单超过 {} 项限制\", MARKET_THEME_COUNT_LIMIT);\n    }\n    let mut ids = HashSet::new();\n    for theme in &mut manifest.themes {\n        validate_market_theme(theme)?;\n        if !ids.insert(theme.id.clone()) {\n            bail!(\"主题市场清单包含重复 ID：{}\", theme.id);\n        }\n        theme.preview_url = market_asset_url(DEFAULT_MARKET_RAW_BASE_URL, &theme.preview)?;\n    }\n    Ok(())\n}\n\nfn validate_market_theme(theme: &DreamSkinMarketTheme) -> anyhow::Result<()> {\n    if !valid_theme_id(&theme.id) {\n        bail!(\"主题市场包含无效 ID：{}\", theme.id);\n    }\n    for (label, value, limit) in [\n        (\"名称\", theme.name.as_str(), 100usize),\n        (\"版本\", theme.version.as_str(), 40usize),\n        (\"作者\", theme.author.as_str(), 100usize),\n        (\"许可证\", theme.license.as_str(), 100usize),\n    ] {\n        if value.trim().is_empty() || value.len() > limit {\n            bail!(\"市场主题 {} 的{}无效\", theme.id, label);\n        }\n    }\n    if theme.description.len() > 500 || theme.tags.len() > 12 {\n        bail!(\"市场主题 {} 的描述或标签数量超过限制\", theme.id);\n    }\n    if theme\n        .tags\n        .iter()\n        .any(|tag| tag.trim().is_empty() || tag.len() > 32)","sourceCodeStart":187,"sourceCodeEnd":223,"githubUrl":"https://github.com/BigPizzaV3/CodexPlusPlus/blob/b1ed92e5e4a2d74095d4b8db5af43cef7acba9c6/crates/codex-plus-core/src/dream_skin_market.rs#L187-L223","documentation":"validate_market_theme requires every manifest theme's id to pass valid_theme_id (a restricted identifier format, e.g. safe path/filename characters only). Invalid IDs are rejected because the id is used to build filesystem paths and asset URLs, so malformed values could break installs or enable path tricks.","triggerScenarios":"install_market_theme_from_base or validate_manifest encounters a theme whose id contains characters outside the allowed set (spaces, slashes, unicode, path separators, empty string) — typically from a hand-written or malicious manifest entry.","commonSituations":"Theme authors naming entries with spaces or Chinese/emoji characters in the id; a manifest generated from directory names containing slashes; a hostile market testing path traversal via crafted ids.","solutions":["Change the theme id in the manifest to a simple identifier (ASCII letters, digits, hyphens/underscores per valid_theme_id) and keep it stable as the directory name","Regenerate the manifest programmatically so ids are slugified rather than taken from display names","If the theme is otherwise fine, republish it under a new valid id"],"exampleFix":"// before\n{ \"id\": \"Cool Theme/v2\", ... }\n// after\n{ \"id\": \"cool-theme-v2\", \"name\": \"Cool Theme v2\", ... }","handlingStrategy":"validation","validationCode":"fn id_is_valid(id: &str) -> bool {\n    !id.is_empty()\n        && id.chars().all(|c| c.is_ascii_alphanumeric() || c == '-' || c == '_')\n}\n// reject manifest entries whose id fails id_is_valid before calling install","typeGuard":null,"tryCatchPattern":"match install_market_theme(state_dir, &theme).await {\n    Ok(s) => println!(\"installed {}\", s.id),\n    Err(e) if e.to_string().contains(\"无效 ID\") => {\n        eprintln!(\"theme id {:?} is not a valid identifier — use ASCII letters/digits/hyphens\", theme.id);\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Slugify theme ids from display names at publish time","Never allow spaces, slashes, or unicode in ids (ids double as directory names)","Keep ids stable across versions — rename via the name field, not the id","Run manifest validation in CI before publishing"],"tags":["marketplace","validation","identifier"],"backgroundTag":"invalid-identifier-format","analyzedSha":"b1ed92e5e4a2d74095d4b8db5af43cef7acba9c6","analyzedAt":"2026-09-19T23:35:21.129Z","contentChangedAt":"2026-09-19T23:35:21.129Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}