{"record":{"id":"d20638d3609487d0","repo":"jdx/mise","slug":"content-level-slsa-verification-stripped-all-compo","errorCode":null,"errorMessage":"content-level SLSA verification stripped all components from archive path: {}","messagePattern":"content-level SLSA verification stripped all components from archive path: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/file.rs","lineNumber":2777,"sourceCode":"\nfn normalize_archive_content_path(path: &Path, strip_components: usize) -> Result<String> {\n    let mut parts = Vec::new();\n    for component in skip_curdir_components(path) {\n        match component {\n            std::path::Component::Normal(part) => parts.push(part.to_string_lossy().to_string()),\n            std::path::Component::CurDir => {}\n            std::path::Component::ParentDir\n            | std::path::Component::RootDir\n            | std::path::Component::Prefix(_) => {\n                bail!(\n                    \"content-level SLSA verification rejected unsafe archive path: {}\",\n                    path.display()\n                )\n            }\n        }\n    }\n    if strip_components > parts.len() {\n        bail!(\n            \"content-level SLSA verification stripped all components from archive path: {}\",\n            path.display()\n        );\n    }\n    let parts = &parts[strip_components..];\n    if parts.is_empty() {\n        bail!(\n            \"content-level SLSA verification stripped all components from archive path: {}\",\n            path.display()\n        );\n    }\n    Ok(parts.join(\"/\"))\n}\n\n#[cfg(test)]\nmod tests {\n    use pretty_assertions::assert_eq;\n","sourceCodeStart":2759,"sourceCodeEnd":2795,"githubUrl":"https://github.com/jdx/mise/blob/533346cc374382b41ec5ff70536252b2e96e725c/src/file.rs#L2759-L2795","documentation":"Before slicing off the configured number of leading path components, mise checks that strip_components is not larger than the number of components in the archive entry's path. If it is, every component would be removed and no usable installed path remains, so verification aborts for that entry.","triggerScenarios":"Content-level SLSA verification where the recipe's strip_components value exceeds the depth of an archive entry's path (e.g. strip_components=2 on an entry like `file.txt`).","commonSituations":"Archive layout changed upstream so top-level directories disappeared; recipe written for nested archives applied to a flat archive; mixed-depth entries where only shallow entries fail.","solutions":["Reduce strip_components in the registry/backend recipe to a value <= the entry depth","Inspect the archive (`tar tf`) to determine its actual nesting depth and match the recipe to it","Pin to an upstream version matching the layout the recipe was written for","If only some entries are shallow, ask upstream to normalize archive layout"],"exampleFix":"// before: archive has entries like `pkg-1.0/bin/tool` (3 components), recipe strips 2 ok;\n// but a sibling archive `bin/tool` (2 components) fails\nstrip_components = 2\n// after\nstrip_components = 1","handlingStrategy":"validation","validationCode":"depth=$(tar -tzf tool.tar.gz | awk -F/ '{print NF}' | sort -n | head -1); echo \"min depth: $depth\"  # strip_components must be < depth","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Match strip_components to the archive's minimum entry depth","Re-check recipes whenever upstream changes archive layout","Pin to versions whose archive layout the recipe was validated against"],"tags":["slsa","archive","strip-components","misconfiguration"],"backgroundTag":"invalid-argument-value","analyzedSha":"533346cc374382b41ec5ff70536252b2e96e725c","analyzedAt":"2026-09-17T13:35:38.149Z","contentChangedAt":"2026-09-17T13:35:38.149Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}