You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* fix: prevent zip-slip path traversal in AddExtension (GHSA-8x9r-hvwg-c55h)
ExtractZip passed raw zip entry names to a callback that wrote files
using filepath.Join with no boundary check, allowing a malicious VSIX
to write arbitrary files outside the extension directory (zip-slip /
CWE-22). The same issue existed in the extra-files loop.
Fix: open an os.Root on the target directory before extraction and
perform all writes through it. os.Root enforces containment at the
syscall level (openat), blocking "../" traversal, absolute paths,
symlink escapes, and TOCTOU races — unlike the lexical prefix-check
approach it replaces. Requires Go 1.24+, already the module minimum.
Two regression tests added (local backends only):
- AddExtensionZipTraversal: VSIX with a "../../../" entry is rejected
- AddExtensionExtraTraversal: extra File with traversal path is rejected
* Add test cases for absolute path and symlink traversal in AddExtension
Covers two additional attack vectors blocked by os.Root:
- Absolute paths (e.g. /tmp/evil) in zip entries and extra files
- Symlink inside the extension directory pointing outside the root
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* Bump Go to 1.25.8 and replace mkdirAllRoot with root.MkdirAll
os.Root.MkdirAll was added in Go 1.25, removing the need for the
custom mkdirAllRoot helper and its infinite-recursion fix for absolute
paths.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
---------
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
0 commit comments