security: sanitize filenames used in multi-file zip uploads (ai:gpt-5) #51
Labels
No labels
nagonag
nagonag/ignore
bug
doc
duplicate
enhancement
help wanted
invalid
question
security
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
IUS/once#51
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Finding from a whole-codebase security review.
Affected code:
filepath.Join(basename, f.Filename).Impact:
Multipart filenames are client-controlled. A filename containing path traversal, an absolute path, or platform-specific separators can become a dangerous zip entry name. Recipients who extract the generated archive with vulnerable tooling may write files outside the intended extraction directory. Single-file uploads use
filepath.Base; the multi-file zip path does not.Suggested fix:
zipW.CreateHeader..or..segment.filepath.Baseunless preserving directories is an explicit feature.../secret,/tmp/secret,a/../../secret, and Windows-style paths.