Skip to content

fix: use safe tar extraction in env pull to prevent path traversal#505

Open
JannikSt wants to merge 1 commit into
mainfrom
security/fix-tar-path-traversal
Open

fix: use safe tar extraction in env pull to prevent path traversal#505
JannikSt wants to merge 1 commit into
mainfrom
security/fix-tar-path-traversal

Conversation

@JannikSt
Copy link
Copy Markdown
Member

@JannikSt JannikSt commented Apr 10, 2026

Replace unsafe tar.extractall() in env pull with the existing _safe_tar_extract helper that validates archive members against path traversal, symlink, and absolute path attacks.

  • Use _safe_tar_extract instead of raw extractall in the pull command
  • Catch ValueError from validation alongside TarError

Note

Medium Risk
Touches archive extraction in the CLI download path, which is security-sensitive; behavior changes are small but could cause pulls to fail if archives contain previously-accepted unsafe entries.

Overview
Security hardening for prime env pull. Replaces direct tar.extractall() with _safe_tar_extract() so pulled environment archives are validated against path traversal, absolute paths, and link entries before extraction.

Extraction now also treats validation failures (ValueError) as user-facing extraction errors alongside tarfile.TarError.

Reviewed by Cursor Bugbot for commit 86a6c28. Bugbot is set up for automated code reviews on this repo. Configure here.

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.

1 participant