Replace unmaintained mholt/archiver/v3 with mholt/archives - #5620
Merged
norman-abramovitz merged 1 commit intoJul 11, 2026
Merged
Conversation
…hives archiver/v3 is archived with reachable path-traversal vulns and no fix (GO-2025-3605, GO-2024-2698, plus GO-2025-4020 via rardecode v1). Replace the single Unarchive call in cfapppush deploy with an archives-based extractor that rejects entries and symlink targets escaping the extraction directory (Zip Slip), which archiver never guarded. govulncheck reachable count drops 8 -> 5 (remaining are containerd/k8s). Closes cloudfoundry#5610
nabramovitz
marked this pull request as draft
July 11, 2026 04:27
norman-abramovitz
approved these changes
Jul 11, 2026
norman-abramovitz
left a comment
Contributor
There was a problem hiding this comment.
LGTM - The archive package gets analyzed by CAPI
norman-abramovitz
marked this pull request as ready for review
July 11, 2026 06:41
nabramovitz
added a commit
to nabramovitz/stratos
that referenced
this pull request
Jul 11, 2026
The deploy websocket's folder/file source handler joined client-supplied folder names and file paths straight onto the temp upload dir, so a message like "../../../home/vcap/app/x" escaped the sandbox: os.Mkdir created directories and os.WriteFile wrote attacker-controlled content outside tempDir, as the backend (vcap) user, before any Cloud Foundry authorization check. Any authenticated Stratos user could reach it. Add safeUploadJoin, which rejects names that are not local (filepath.IsLocal) before joining — the same guard cloudfoundry#5620 applied to archive extraction in unarchive.go, which never covered this separate upload loop. Route both the folder-create and file-write sinks through it. Legitimate nested paths still pass; only traversal and absolute paths are rejected. CodeQL: go/path-injection in cfapppush/deploy.go (297, 338).
norman-abramovitz
pushed a commit
that referenced
this pull request
Jul 11, 2026
The deploy websocket's folder/file source handler joined client-supplied folder names and file paths straight onto the temp upload dir, so a message like "../../../home/vcap/app/x" escaped the sandbox: os.Mkdir created directories and os.WriteFile wrote attacker-controlled content outside tempDir, as the backend (vcap) user, before any Cloud Foundry authorization check. Any authenticated Stratos user could reach it. Add safeUploadJoin, which rejects names that are not local (filepath.IsLocal) before joining — the same guard #5620 applied to archive extraction in unarchive.go, which never covered this separate upload loop. Route both the folder-create and file-write sinks through it. Legitimate nested paths still pass; only traversal and absolute paths are rejected. CodeQL: go/path-injection in cfapppush/deploy.go (297, 338).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Replaces
github.com/mholt/archiver/v3(archived upstream, no fixes coming) with its maintained successorgithub.com/mholt/archivesat the single call site: unpacking a user-uploaded application archive during cf push (plugins/cfapppush/deploy.go).Why
make audit(govulncheck) reports three reachable vulnerabilities through this path with no upstream fix available:nwaples/rardecodev1, pulled in by archiver)How
archiveshas no high-levelUnarchive; extraction is handler-driven, which puts path handling in our hands. The newunarchivehelper rejects any entry whose name escapes the extraction directory (filepath.IsLocal) and any symlink whose target resolves outside it — the Zip Slip guard archiver never had. Format support stays broad viaarchives.Identify(zip, tar, tar.gz, ...).Dependency effect:
archiver/v3andrardecodev1 evicted from both go.mods;archives v0.1.5+rardecode/v2in. govulncheck reachable count drops 8 → 5 (the remainder are the containerd/k8s family, tracked separately).Tests
Four new tests in
unarchive_test.go: zip and tar.gz happy paths, Zip Slip rejection, escaping-symlink rejection. Fullmake check gategreen.Note for future maintenance
Running bare
go mod tidyinsrc/jetstreamsilently drops all plugin dependencies because plugin imports live in the generatedextra_plugins.go— rungo generate ./...there first.Closes #5610