astrid-runtime/astrid · error

Compiled WASM binary

Error message

Compiled WASM binary {} escapes configured target directory {}

What it means

Fired by locate_wasm_binary after canonicalization when the artifact resolves outside the configured target directory root — e.g. a regular file under a symlinked parent redirects elsewhere. Containment is enforced even when the target root itself is a legitimate symlink.

Solutions

  1. Point the target directory at a real directory without symlinked parents
  2. Rebuild into a target dir fully contained at the configured path
  3. Inspect for environment tampering (CARGO_TARGET_DIR overrides, link farms)
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at crates/astrid-build/src/rust.rs:655 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/5129bc68cb3bad8a. Report an issue: GitHub.

Appendix: source

Thrown at crates/astrid-build/src/rust.rs:655

    // A regular artifact beneath a symlinked parent could still resolve
    // outside the configured root. Canonicalize only for containment; return
    // Cargo's path so callers retain the authoritative configured location,
    // including when the target root itself is a legitimate symlink.
    let resolved_target_root = fs::canonicalize(target_root).with_context(|| {
        format!(
            "Failed to resolve target directory {}",
            target_root.display()
        )
    })?;
    let resolved_candidate = fs::canonicalize(&candidate).with_context(|| {
        format!(
            "Failed to resolve compiled WASM binary {}",
            candidate.display()
        )
    })?;
    if !resolved_candidate.starts_with(&resolved_target_root) {
        bail!(
            "Compiled WASM binary {} escapes configured target directory {}",
            candidate.display(),
            target_root.display()
        );
    }

    Ok(candidate)
}

/// Merge the developer's `Capsule.toml` with any extracted description.
fn build_manifest_content(
    dir: &Path,
    wasm_path: &Path,
    crate_name: &str,
    package_version: &str,
    wasm_name: &str,
) -> Result<String> {
    let capsule_description = extract_capsule_description(wasm_path);

View on GitHub (pinned to affd8760f4)