{"record":{"id":"c9138b6bc635b472","repo":"jdx/mise","slug":"the-packslip-names-an-artifact-which-is-not","errorCode":null,"errorMessage":"the packslip names an artifact {:?}, which is not a plain file name","messagePattern":"the packslip names an artifact (.+?), which is not a plain file name","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/backend/packslip.rs","lineNumber":1379,"sourceCode":"        let mut commands = BTreeMap::new();\n        if let Some(req) = &artifact.requires {\n            for bin in &req.bin {\n                // Spawnable, not merely present: the probe below runs the\n                // path with `--version`, so a shebang-only script or a `.ps1`\n                // would be chosen and then fail to start.\n                if let Some(path) = ctx.ts.which_bin_spawnable(&ctx.config, &bin.name).await {\n                    commands.insert(bin.name.clone(), path);\n                }\n            }\n        }\n        crate::packslip_requirements::check(&artifact, &commands)\n            .await\n            .enforce(raw_opts.get(\"ignore_requirements\") == Some(\"true\"))?;\n        let Some(url) = artifact.url.clone() else {\n            bail!(\"the packslip gives no download URL for {}\", artifact.name);\n        };\n        if !file::is_plain_file_name(&artifact.name) {\n            bail!(\n                \"the packslip names an artifact {:?}, which is not a plain file name\",\n                artifact.name\n            );\n        }\n        let file_path = tv.download_path().join(&artifact.name);\n        ctx.pr.next_operation();\n        ctx.pr.set_message(format!(\"download {}\", artifact.name));\n        crate::packslip::download_file(&url, &file_path, Some(ctx.pr.as_ref())).await?;\n\n        // The signed digest and size first, then what the lockfile remembers:\n        // a lock entry written from an earlier packslip keeps its checksum and\n        // is compared, so a newly signed manifest cannot quietly replace what\n        // the project committed to. A fresh entry records the signed sha256.\n        ctx.pr.next_operation();\n        ctx.pr.set_message(format!(\"verify {}\", artifact.name));\n        verify_bundle(&bundle, &pin, require_log, &[&file_path])\n            .wrap_err_with(|| format!(\"verifying {} against its packslip\", artifact.name))?;\n        {","sourceCodeStart":1361,"sourceCodeEnd":1397,"githubUrl":"https://github.com/jdx/mise/blob/533346cc374382b41ec5ff70536252b2e96e725c/src/backend/packslip.rs#L1361-L1397","documentation":"mise derives the local download path by joining the tool's download directory with the artifact's name. If the artifact name is not a plain file name (contains path separators, `..`, absolute path components, etc.), it could escape the download directory, so mise rejects it as a potential path traversal rather than using it.","triggerScenarios":"install_payload calls file::is_plain_file_name(&artifact.name) and it returns false — the packslip declares an artifact name like `sub/dir/foo.tar.gz`, `../foo`, or an absolute path.","commonSituations":"A maliciously crafted or buggy manifest embeds directory components in artifact names; a maintainer names assets with prefixes like `dist/foo.tar.gz`; automated manifest generation copies a URL path into the name field.","solutions":["Report the manifest to the maintainer to rename artifacts to plain file names","Use a version whose packslip uses simple file names","If you control the manifest, set name to the bare file name and keep any directory structure out of it","If you cannot trust the manifest, stop using that source/backend for the tool"],"exampleFix":"// before\n[[artifacts]]\nname = \"dist/foo-linux-amd64.tar.gz\"\n// after\n[[artifacts]]\nname = \"foo-linux-amd64.tar.gz\"","handlingStrategy":"validation","validationCode":"# Only trust manifests whose artifact names are plain file names\njq -e '.artifacts | all(.name | test(\"^[A-Za-z0-9._@+-]+$\"))' packslip.json","typeGuard":"const isPlainFileName = (n: string) => /^[^/\\\\]+$/.test(n) && !n.startsWith('.');","tryCatchPattern":null,"preventionTips":["Treat non-plain artifact names in manifests as untrusted input","Only use packslips from sources you control or vetted registries","Report manifests embedding directory components to maintainers"],"tags":["packslip","path-traversal","security","validation"],"backgroundTag":"path-traversal-blocked","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"}