astrid-runtime/astrid · error

Malicious archive detected: invalid path

Error message

Malicious archive detected: invalid path '{}'

What it means

Security guard in unpack_and_install_internal while iterating tar entries: an entry path is absolute or otherwise escapes the extraction root (e.g. contains `..` components). This is the classic Zip-Slip/path-traversal attack vector in malicious archives, so installation is refused outright rather than sanitized. All four unpack_and_install entrypoints funnel through this check.

Solutions

  1. Do not install this archive; it is hostile or corrupted
  2. Obtain the capsule from a trusted source
  3. Rebuild/repack the archive with strictly relative paths
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at crates/astrid-capsule-install/src/archive.rs:365 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of astrid-runtime/astrid@affd8760f4 (2026-09-09). Data as JSON: /api/errors/a8869076bc039d52. Report an issue: GitHub.

Appendix: source

Thrown at crates/astrid-capsule-install/src/archive.rs:365

    let tar_gz = std::fs::File::open(archive_path)
        .with_context(|| format!("Failed to open archive: {}", archive_path.display()))?;

    let tar = flate2::read::GzDecoder::new(tar_gz);
    let mut archive = tar::Archive::new(tar);

    for entry in archive
        .entries()
        .context("Failed to read archive entries")?
    {
        let mut entry = entry.context("Failed to read archive entry")?;
        let entry_path = entry.path().context("Invalid path in archive")?;

        if entry_path.is_absolute()
            || entry_path
                .components()
                .any(|c| matches!(c, std::path::Component::ParentDir))
        {
            bail!(
                "Malicious archive detected: invalid path '{}'",
                entry_path.display()
            );
        }

        let out_path = unpack_dir.join(&entry_path);
        if let Some(parent) = out_path.parent() {
            std::fs::create_dir_all(parent)?;
        }

        if entry.header().entry_type().is_symlink() || entry.header().entry_type().is_hard_link() {
            bail!(
                "Malicious archive detected: symlinks are not allowed ('{}')",
                entry_path.display()
            );
        }

        entry

View on GitHub (pinned to affd8760f4)