{"record":{"id":"c31b6e2dddbbf3d9","repo":"jdx/mise","slug":"vfox-plugin-archive-contains-a-link-or-special-fil","errorCode":null,"errorMessage":"vfox plugin archive contains a link or special file","messagePattern":"vfox plugin archive contains a link or special file","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/plugins/packslip.rs","lineNumber":213,"sourceCode":"    ensure!(\n        artifact.requires.is_none(),\n        \"vfox plugin artifacts must not declare host requirements\"\n    );\n    ensure!(\n        matches!(artifact.format.as_deref(), Some(\"tar.gz\" | \"tgz\")),\n        \"vfox plugin artifacts currently require tar.gz format\"\n    );\n    Ok(())\n}\n\n/// Reject links and special files before extraction, including links whose\n/// targets might otherwise be resolved while unpacking a later archive entry.\npub(crate) fn validate_archive(path: &Path) -> Result<()> {\n    let reader = flate2::read::GzDecoder::new(std::fs::File::open(path)?);\n    let mut archive = jdx_tar::Archive::new(reader);\n    for entry in archive.entries()? {\n        let entry = entry?;\n        ensure!(\n            matches!(\n                entry.entry_type(),\n                jdx_tar::EntryType::File | jdx_tar::EntryType::Directory\n            ),\n            \"vfox plugin archive contains a link or special file\"\n        );\n        let path = entry.path()?;\n        for component in path.components() {\n            if component == Component::CurDir {\n                continue;\n            }\n            let Component::Normal(name) = component else {\n                bail!(\"vfox plugin archive contains an unsafe path\");\n            };\n            let name = name.to_string_lossy();\n            ensure!(\n                !name.contains(['\\\\', ':'])\n                    && !name.eq_ignore_ascii_case(\".git\")","sourceCodeStart":195,"sourceCodeEnd":231,"githubUrl":"https://github.com/jdx/mise/blob/533346cc374382b41ec5ff70536252b2e96e725c/src/plugins/packslip.rs#L195-L231","documentation":"When validating a vfox plugin archive, mise rejects any tar entry that is not a regular File or Directory — symlinks, hardlinks, and special files (devices, fifos) are refused. This prevents archives from shipping links that could otherwise be resolved to paths outside the install directory while a later entry is being unpacked (a classic tar-link escape).","triggerScenarios":"Installing a vfox plugin whose tar.gz contains symlink or hardlink entries (e.g. lib/current -> ../../.., or a link to /etc), or device/fifo special entries.","commonSituations":"Plugin archives packaged on Unix with developer symlinks left inside (node_modules-style links); archives built with tar flags preserving links; a deliberately malicious plugin using link-then-write to escape the install directory.","solutions":["Rebuild the plugin archive dereferencing links into real files (e.g. `tar --dereference -czf plugin.tar.gz ...` or `tar -h`)","Remove symlinks/special files from the plugin directory before packaging","Only install plugins from trusted sources — the archive is malformed or hostile, so do not attempt to bypass the check","Ask the plugin author to republish a link-free archive"],"exampleFix":"// before\nln -s /etc/passwd extra.lua && tar czf plugin.tar.gz myplugin/\n// after\ncp real-extra.lua myplugin/extra.lua && tar czf plugin.tar.gz myplugin/","handlingStrategy":"validation","validationCode":"const types = await tarList(archivePath);\nconst bad = types.filter(e => e.type !== 'file' && e.type !== 'directory');\nif (bad.length) throw new Error(`archive contains links/special files: ${bad.map(e=>e.path).join(', ')}`);","typeGuard":null,"tryCatchPattern":"try { await installVfoxPlugin(url); } catch (e) {\n  if (String(e).includes('link or special file')) {\n    console.error('Plugin archive contains symlinks/special files; rebuild with tar -h or use a trusted source.');\n    return null;\n  }\n  throw e;\n}","preventionTips":["Package with tar --dereference (-h) to inline symlinks","Run `tar -tvf plugin.tar.gz | grep -E '^l|^h'` in CI before publishing","Avoid copying prebuilt directories that contain developer symlinks"],"tags":["archive","vfox","security","symlink"],"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"}