Skip to content

Protect template extraction from tar bombs and path traversal - #565

Merged
tarcisiozf merged 2 commits into
mainfrom
DEVSVCS-5281/patch-tarball-extraction
Aug 3, 2026
Merged

Protect template extraction from tar bombs and path traversal#565
tarcisiozf merged 2 commits into
mainfrom
DEVSVCS-5281/patch-tarball-extraction

Conversation

@tarcisiozf

Copy link
Copy Markdown
Contributor

This pull request strengthens the security and robustness of tarball extraction in the template repository client. It introduces strict limits on tarball download size, extracted file size, total extracted size, and file count to protect against resource exhaustion and malicious archives. The extraction logic is also hardened against path traversal attacks. Comprehensive tests are added to verify these protections.

Security and Resource Limiting Improvements:

  • Added configurable limits for maximum tarball download size, per-file extracted size, total extracted size, and file count to prevent disk exhaustion and "tar bomb" attacks (client.go).
  • Enforced the maximum tarball download size during download, deleting partial files that exceed the limit (DownloadTarball).
  • Enforced per-file size, total extracted size, and file count limits during extraction, with clear error messages when limits are exceeded (extractTarball).
  • Hardened path validation during extraction to prevent path traversal and ensure all extracted files remain within the intended destination directory (extractTarball).

@github-actions

github-actions Bot commented Aug 3, 2026

Copy link
Copy Markdown

👋 tarcisiozf, thanks for creating this pull request!

To help reviewers, please consider creating future PRs as drafts first. This allows you to self-review and make any final changes before notifying the team.

Once you're ready, you can mark it as "Ready for review" to request feedback. Thanks!

@tarcisiozf
tarcisiozf enabled auto-merge August 3, 2026 19:57
@tarcisiozf
tarcisiozf added this pull request to the merge queue Aug 3, 2026
Merged via the queue into main with commit 8c15c6d Aug 3, 2026
22 checks passed
@tarcisiozf
tarcisiozf deleted the DEVSVCS-5281/patch-tarball-extraction branch August 3, 2026 21:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants