{"record":{"id":"66413aeb27867f3e","repo":"AlistGo/alist","slug":"errarchiveillegalpath-66413a","errorCode":"ErrArchiveIllegalPath","errorMessage":"archive entry has illegal path: %s","messagePattern":"archive entry has illegal path: (.+?)","errorType":"exception","errorClass":"ErrArchiveIllegalPath","httpStatus":null,"severity":"error","filePath":"internal/archive/tool/helper.go","lineNumber":137,"sourceCode":"\tvar err error\n\tfiles := r.Files()\n\tif args.InnerPath == \"/\" {\n\t\tfor i, file := range files {\n\t\t\tname := file.Name()\n\t\t\tinfo := file.FileInfo()\n\t\t\tif info.IsDir() {\n\t\t\t\tvar dirPath string\n\t\t\t\tdirPath, err = SecureJoin(outputPath, name)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tif err = os.MkdirAll(dirPath, 0700); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif !info.Mode().IsRegular() {\n\t\t\t\treturn fmt.Errorf(\"%w: %s\", ErrArchiveIllegalPath, name)\n\t\t\t}\n\t\t\tvar dstPath string\n\t\t\tdstPath, err = SecureJoin(outputPath, name)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tif err = os.MkdirAll(filepath.Dir(dstPath), 0700); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\terr = _decompress(file, dstPath, args.Password, func(_ float64) {}, limiter)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tup(float64(i+1) * 100.0 / float64(len(files)))\n\t\t}\n\t} else {\n\t\tinnerPath := strings.TrimPrefix(args.InnerPath, \"/\")\n\t\tinnerBase := stdpath.Base(innerPath)","sourceCodeStart":119,"sourceCodeEnd":155,"githubUrl":"https://github.com/AlistGo/alist/blob/843d9dc8149126976b2625911e45a4d3ffd6f2f5/internal/archive/tool/helper.go#L119-L155","documentation":"Guard in internal/archive/tool/helper.go during generic archive walking: after directory entries are handled, any entry whose FileInfo mode is not regular is rejected with ErrArchiveIllegalPath. This is the shared helper used by archive tools, defending against special-file members before SecureJoin-destined extraction.","triggerScenarios":"Running Decompression via the archive tool on an archive containing symlinks/devices/FIFOs in the walked scope (non-inner-base path).","commonSituations":"Tar/zip archives from Unix systems containing links; backup archives; hostile archives.","solutions":["Repack with dereferenced links (tar -h, cp -rL before zipping)","Use a system extractor that supports special files","Audit the archive listing first to identify the offending member names"],"exampleFix":"# inspect offending members first\n# tar: tar tvf bundle.tgz | grep -E '^(l|c|b|p)'\n# then repack with links followed: tar czfh bundle.tgz mydir/","handlingStrategy":"validation","validationCode":null,"typeGuard":"func isSafeEntryMode(info fs.FileInfo) bool {\n    return info.IsDir() || info.Mode().IsRegular()\n}","tryCatchPattern":"if err := helper.Decompress(...); err != nil && errors.Is(err, tool.ErrArchiveIllegalPath) {\n    // identify the member named in the error and quarantine the archive\n}","preventionTips":["Audit archive contents (tar tvf shows type flags; unzip -l) before extraction","Repack with links dereferenced (tar -h / cp -rL)","Treat unexpected special members in third-party archives as malicious"],"tags":["archive","security","symlink","extraction"],"backgroundTag":null,"analyzedSha":"843d9dc8149126976b2625911e45a4d3ffd6f2f5","analyzedAt":"2026-08-15T12:14:11.722Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}