BigPizzaV3/CodexPlusPlus · error · anyhow::Error

Dream Skin theme path is not a safe directory

Error message

Dream Skin theme path is not a safe directory

What it means

Safety guard in load_stored_dream_skin_theme: the theme directory under the state dir is not a regular directory (missing, a symlink, or another special file), so loading it could escape the themes root. The offending input is the on-disk directory entry for the given theme id.

Source

Thrown at crates/codex-plus-core/src/dream_skin_library.rs:377

        let _ = remove_known_theme_directory(&staging);
        return Err(error);
    }
    let stored = load_stored_dream_skin_theme(state_dir, &config.id)?;
    Ok(summary_from_draft(&stored, false, false))
}

pub fn load_stored_dream_skin_theme(
    state_dir: &Path,
    id: &str,
) -> anyhow::Result<DreamSkinThemeDraft> {
    if !valid_theme_id(id) {
        bail!("invalid Dream Skin theme id");
    }
    let directory = state_dir.join(THEMES_DIR).join(id);
    let metadata = std::fs::symlink_metadata(&directory)
        .with_context(|| format!("Dream Skin theme not found: {id}"))?;
    if !metadata.file_type().is_dir() || metadata.file_type().is_symlink() {
        bail!("Dream Skin theme path is not a safe directory");
    }
    let config_path = directory.join(THEME_CONFIG_FILE);
    let metadata = std::fs::symlink_metadata(&config_path)
        .with_context(|| format!("Dream Skin theme config not found: {id}"))?;
    if !metadata.file_type().is_file()
        || metadata.file_type().is_symlink()
        || metadata.len() > THEME_CONFIG_LIMIT
    {
        bail!("invalid Dream Skin theme config");
    }
    let config: DreamSkinThemeConfig = serde_json::from_slice(&std::fs::read(&config_path)?)?;
    if config.id != id {
        bail!("Dream Skin theme id does not match directory");
    }
    let image = find_theme_image(&directory)
        .ok_or_else(|| anyhow::anyhow!("Dream Skin theme must contain exactly one image"))?;
    let draft = DreamSkinThemeDraft {
        config,

View on GitHub (pinned to f2074595a2)

Solutions

  1. Remove the symlink/special file and reinstall the theme
  2. Check the state dir for tampering or sync-tool artifacts
  3. Refresh the theme from its source
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at crates/codex-plus-core/src/dream_skin_library.rs:377 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of BigPizzaV3/CodexPlusPlus@f2074595a2 (2026-08-23). Data as JSON: /api/errors/e34bc26325350515. Report an issue: GitHub.