Skip to content

fix: reject oversized and invalid zip uploads (#25877)#26272

Merged
f0ssel merged 1 commit into
release/2.29from
cherry-pick/25877/release/2.29
Jun 11, 2026
Merged

fix: reject oversized and invalid zip uploads (#25877)#26272
f0ssel merged 1 commit into
release/2.29from
cherry-pick/25877/release/2.29

Conversation

@jdomeracki-coder

Copy link
Copy Markdown
Contributor

Backport of #25877 to release/2.29.

Cherry-picked with git cherry-pick -x (2f011fd2a3); the commit message references the original PR.

Cherry-pick conflict resolution

The core fix (archive/archive.go, coderd/files.go) applied cleanly. coderd/files_test.go needed a small adaptation: this branch predates the shared test-client refactor, so the new buildZipWithFile helper was kept and the two new sub-tests create their own client, matching the other sub-tests on this branch.

go test ./archive/... passes and the coderd test package compiles.

Generated by Coder Agents on behalf of @jdomeracki-coder.

Enforce aggregate limits when converting uploaded ZIP archives to tar
so compressed inputs cannot expand without bound in memory.

Also treat malformed ZIP entry metadata and content mismatches as
client errors during conversion, returning 400 for invalid archives and
413 when expanded tar output exceeds the upload limit.

Ref: https://linear.app/codercom/issue/PLAT-274/zip-upload-decompressed-without-aggregate-size-limit-sec-103
(cherry picked from commit 2f011fd)
@jdomeracki-coder jdomeracki-coder added the cherry-pick/v2.29 Needs to be cherry-picked to the 2.29 release branch label Jun 11, 2026
@jdomeracki-coder jdomeracki-coder requested a review from f0ssel June 11, 2026 17:44
@f0ssel f0ssel merged commit 069f6cf into release/2.29 Jun 11, 2026
29 checks passed
@f0ssel f0ssel deleted the cherry-pick/25877/release/2.29 branch June 11, 2026 18:05
@github-actions github-actions Bot locked and limited conversation to collaborators Jun 11, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

cherry-pick/v2.29 Needs to be cherry-picked to the 2.29 release branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants