Skip to content

Feature/rewrite stateless - #16

Merged
kmturley merged 4 commits into
mainfrom
feature/rewrite-stateless
Jan 12, 2025
Merged

Feature/rewrite stateless#16
kmturley merged 4 commits into
mainfrom
feature/rewrite-stateless

Conversation

@kmturley

Copy link
Copy Markdown
Member

No description provided.

@kmturley
kmturley merged commit 81e399f into main Jan 12, 2025
kmturley added a commit that referenced this pull request Jul 31, 2026
…anch

CodeQL flagged this PR with 1 new high-severity js/zipslip alert at
archive.ts's AdmZip Windows-fallback branch. The code itself is
byte-identical to what's on main (pre-existing, still-open alert #16
at the old file.ts:67) - not a vulnerability this refactor introduced,
but CodeQL treats it as "new" since the code moved to a new file/path.

The validation (isSafeArchiveEntryPath()) was already correct at
runtime, but CodeQL's dataflow analysis wasn't recognizing it as a
guard: each entry was validated and written in the same forEach
iteration, one entry at a time. The adjacent .7z branch a few lines
below - which isn't flagged - instead validates every entry up front
and only writes afterward if all of them pass. Restructured the AdmZip
branch to match that already-safe shape: map entries to their sanitized
names, find any unsafe one and throw before writing anything, then
write. Same validation logic, same error message, same result -
verified via the full test suite (218/218 passing) - just reshaped so
the guard-then-sink relationship is unambiguous to static analysis.
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