BigPizzaV3/CodexPlusPlus · error

主题包包含加密内容或链接:

Error message

主题包包含加密内容或链接:{name}

What it means

Each ZIP entry is checked: encrypted entries (encrypted()) and symlinks (is_symlink()) are rejected with the entry name embedded in the message. The library refuses packages containing encrypted content or filesystem links to prevent unsafe or uninspectable payloads.

Solutions

  1. Repackage without encryption — do not password-protect theme files
  2. Exclude symlinks when creating the archive (`zip -r theme.zip . -x` and avoid -y; dereference with -L or copy real files)
  3. Replace each symlink with the actual file it points to before zipping
  4. Identify the offending entry from the error message and remove/recreate it

Example fix

// before
zip -ry theme.zip assets/   # keeps symlinks
// after
zip -rL theme.zip assets/   # dereferences symlinks, no encryption
Defensive patterns

Strategy: validation

Validate before calling

let mut archive = ZipArchive::new(Cursor::new(&bytes))?;
for i in 0..archive.len() {
    let f = archive.by_index(i)?;
    if f.encrypted() || f.is_symlink() {
        return Err(EncryptedOrSymlink(f.name().to_string()));
    }
}

Try / catch

match validate_and_read_package(&bytes, platform) {
    Err(e) if e.to_string().contains("加密内容或链接") => {
        Err(UserFacingError::UnsupportedArchiveEntry)
    }
    other => other,
}

Prevention

When it happens

Trigger: A package contains any entry created with ZIP encryption/password protection, or a symlink entry, and validate_and_read_package reads that entry.

Common situations: Author password-protected the archive or individual files; packaging on Unix with `zip -y` including symlinks; build systems emitting symlink entries for assets.

Understand the failure class

Background: Path traversal blocked: "path escapes the workspace" and "outside site root" errors when a path will not stay inside its allowed directory — this error's family across 26 libraries.

Related errors


AI-assisted analysis of BigPizzaV3/CodexPlusPlus@b1ed92e5e4 (2026-09-19). Data as JSON: /api/errors/86debcdfe3943e82. Report an issue: GitHub.

Appendix: source

Thrown at crates/codex-plus-core/src/dream_skin_package.rs:109

    if bytes.is_empty() || bytes.len() > PACKAGE_LIMIT {
        bail!("Dream Skin 主题包超过 32 MiB 限制");
    }
    let mut archive =
        ZipArchive::new(Cursor::new(bytes)).context("Dream Skin 主题包不是有效 ZIP")?;
    if archive.len() == 0 || archive.len() > FILE_LIMIT {
        bail!("Dream Skin 主题包文件数量必须在 1 到 32 之间");
    }

    let mut entries = Vec::new();
    let mut unpacked = 0usize;
    for index in 0..archive.len() {
        let file = archive
            .by_index(index)
            .context("读取 Dream Skin ZIP 条目失败")?;
        let name = file.name().to_string();
        validate_archive_entry_name(&name)?;
        if file.encrypted() || file.is_symlink() {
            bail!("主题包包含加密内容或链接:{name}");
        }
        if file.is_dir() {
            entries.push((name, None));
            continue;
        }
        let base_name = name.rsplit('/').next().unwrap_or_default();
        if base_name == ".DS_Store" || name.starts_with("__MACOSX/") {
            entries.push((name, None));
            continue;
        }
        if !ALLOWED_FILES.contains(&base_name) {
            bail!("主题包包含不支持的文件:{name}");
        }
        let limit = file_limit(base_name);
        let mut content = Vec::new();
        file.take((limit + 1) as u64)
            .read_to_end(&mut content)
            .context("读取 Dream Skin ZIP 内容失败")?;

View on GitHub (pinned to b1ed92e5e4)