{"record":{"id":"b3772d2dd8114418","repo":"BigPizzaV3/CodexPlusPlus","slug":"dream-skin-path-must-not-be-a-symbolic-link","errorCode":null,"errorMessage":"Dream Skin path must not be a symbolic link","messagePattern":"Dream Skin path must not be a symbolic link","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/codex-plus-core/src/dream_skin_library.rs","lineNumber":663,"sourceCode":"fn remove_known_theme_directory(directory: &Path) -> anyhow::Result<()> {\n    if !directory.exists() {\n        return Ok(());\n    }\n    ensure_known_theme_directory(directory)?;\n    for entry in std::fs::read_dir(directory)? {\n        let path = entry?.path();\n        std::fs::remove_file(&path)\n            .with_context(|| format!(\"failed to remove {}\", path.display()))?;\n    }\n    std::fs::remove_dir(directory)\n        .with_context(|| format!(\"failed to remove {}\", directory.display()))?;\n    Ok(())\n}\n\nfn reject_symlink(path: &Path) -> anyhow::Result<()> {\n    let metadata = std::fs::symlink_metadata(path)?;\n    if metadata.file_type().is_symlink() {\n        bail!(\"Dream Skin path must not be a symbolic link\");\n    }\n    Ok(())\n}\n\nfn summary_from_draft(\n    draft: &DreamSkinThemeDraft,\n    active: bool,\n    modified: bool,\n) -> DreamSkinThemeSummary {\n    DreamSkinThemeSummary {\n        key: format!(\"stored:{}\", draft.config.id),\n        id: draft.config.id.clone(),\n        name: draft.config.name.clone(),\n        preview_path: draft.image_path.clone(),\n        kind: DreamSkinThemeKind::Stored,\n        builtin: false,\n        active,\n        modified,","sourceCodeStart":645,"sourceCodeEnd":681,"githubUrl":"https://github.com/BigPizzaV3/CodexPlusPlus/blob/b1ed92e5e4a2d74095d4b8db5af43cef7acba9c6/crates/codex-plus-core/src/dream_skin_library.rs#L645-L681","documentation":"reject_symlink checks symlink_metadata on a Dream Skin path and fails if the path itself is a symbolic link. The library refuses to write, replace, or operate through symlinks so that a malicious or misconfigured link cannot redirect theme writes outside the state directory.","triggerScenarios":"save_dream_skin_theme, save_validated_dream_skin_package, or replace_theme_directory is invoked while the state_dir theme path (or the existing target directory) is a symlink — e.g. the user symlinked dream-skin/themes/<id> into a dotfiles repo, or a previous install left a link behind.","commonSituations":"Developers managing their theme folder via symlinks for sync (Dropbox, dotfiles, stow); a cleanup tool replaced directories with links; a malicious archive contained a symlink entry that got extracted into the themes directory.","solutions":["Replace the symlink with a real directory: rm the link and let the library re-create the theme directory, or copy the linked content back to a real directory","Reinstall the theme via the library so a fresh physical directory is created","Check the state_dir path itself (dream-skin/... ancestors) for symlinks and flatten them","If you manage themes externally, copy files in/out of a real directory instead of linking"],"exampleFix":"# before\nln -s ~/dotfiles/dream-themes/cool-theme ~/.codex-plus/dream-skin/themes/cool-theme\n# after\ncp -rL ~/dotfiles/dream-themes/cool-theme ~/.codex-plus/dream-skin/themes/cool-theme  # real directory, no symlink","handlingStrategy":"validation","validationCode":"fn assert_not_symlink(path: &Path) -> anyhow::Result<()> {\n    let md = std::fs::symlink_metadata(path)?;\n    if md.file_type().is_symlink() {\n        anyhow::bail!(\"{} is a symlink; replace it with a real directory first\", path.display());\n    }\n    Ok(())\n}\n// call before save_dream_skin_theme / install for each path you will pass","typeGuard":"fn is_real_dir(p: &Path) -> bool {\n    matches!(std::fs::symlink_metadata(p).map(|m| m.file_type()), Ok(f) if f.is_dir() && !f.is_symlink())\n}","tryCatchPattern":"match save_dream_skin_theme(state_dir, &draft) {\n    Ok(s) => println!(\"saved {}\", s.id),\n    Err(e) if e.to_string().contains(\"symbolic link\") => {\n        eprintln!(\"{} is a symlink — replace with a real directory before saving\", state_dir.display());\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Do not symlink theme directories into dotfiles/Dropbox; copy instead","Check state_dir ancestors for symlinks before configuring the state directory","After extracting third-party theme archives, verify no entries are symlinks (tar -h or archive tool settings)","Reinstall themes through the library rather than manually linking directories"],"tags":["filesystem","security","symlink"],"backgroundTag":"path-traversal-blocked","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"}