Kuberwastaken/claurst · error

Path contains null bytes

Error message

Path contains null bytes: {:?}

What it means

Path-security guard in validate_memory_path (mirrors the TypeScript securePath check): the team-memory entry's relative path contains a NUL byte (the formatted value is the offending path). Null bytes can truncate path handling and are never legitimate in sync keys.

Solutions

  1. Reject/drop the offending entry — a null byte in a path indicates corruption or tampering
  2. Re-create the team-memory file with a clean filename and re-push
  3. Audit the repo for other entries failing the same validation
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at src-rust/crates/core/src/team_memory_sync.rs:84 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of Kuberwastaken/claurst@b0637c97ec (2026-09-10). Data as JSON: /api/errors/182290362b5bbd9a. Report an issue: GitHub.

Appendix: source

Thrown at src-rust/crates/core/src/team_memory_sync.rs:84

    hasher.update(content.as_bytes());
    format!("sha256:{}", hex::encode(hasher.finalize()))
}

// ---------------------------------------------------------------------------
// Path security validation
// ---------------------------------------------------------------------------

/// Reject paths that could escape the team-memory directory.
///
/// Checks performed (mirroring the TypeScript `securePath` validation):
/// - No null bytes
/// - No URL-encoded traversal sequences (`%2e`, `%2f`, case-insensitive)
/// - No backslashes
/// - Not an absolute path (Unix `/` or Windows `C:` style)
/// - No `..` components
pub fn validate_memory_path(path: &str) -> Result<()> {
    if path.contains('\0') {
        anyhow::bail!("Path contains null bytes: {:?}", path);
    }
    let lower = path.to_ascii_lowercase();
    if lower.contains("%2e") || lower.contains("%2f") {
        anyhow::bail!("Path contains URL-encoded traversal sequences: {:?}", path);
    }
    if path.contains('\\') {
        anyhow::bail!("Path contains backslashes: {:?}", path);
    }
    if path.starts_with('/') {
        anyhow::bail!("Absolute Unix paths not allowed: {:?}", path);
    }
    // Windows-style absolute path: e.g. "C:" or "c:"
    if path.len() >= 2 {
        let mut chars = path.chars();
        let first = chars.next().unwrap();
        if first.is_ascii_alphabetic() && chars.next() == Some(':') {
            anyhow::bail!("Absolute Windows paths not allowed: {:?}", path);
        }

View on GitHub (pinned to b0637c97ec)