fix: reject path traversal sequences in extras validator - #482
Merged
Conversation
The extras validator was a no-op and accepted any value. Reject values containing parent directory references (..), backslashes, encoded slashes (%2F) or backslashes (%5C), and protocol-relative prefixes (//), including multi-level percent-encoded variants.
wkillerud
approved these changes
Aug 21, 2026
github-actions Bot
pushed a commit
that referenced
this pull request
Aug 21, 2026
## [5.2.1](v5.2.0...v5.2.1) (2026-08-21) ### Bug Fixes * reject path traversal sequences in extras validator ([#482](#482)) ([310dcbf](310dcbf))
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The extras validator was a no-op. This PR rejects values that contain path traversal sequences or encoded characters that could be used to escape the expected package path.
What is rejected
../../etc/passwd..%2F..%2Fetc%2Fpasswd..%252F..%252F%255Cexternal.example..\external.example,..%5Cexternal.example//external.exampleWhat remains allowed
Normal asset path extras are unaffected:
dist/style.cssmain/index.js/foo/a9-8_3/index.jsCSS and JS files that use relative references (e.g.
url('../fonts/font.woff2')) are also unaffected. The browser resolves..client-side before making the HTTP request, and the WHATWG URL parser in the service normalises any remaining literal..segments before extras are extracted. Encoded traversal sequences cannot be normalised this way and are what this validator now blocks.Tests
Tests are added that fail before the fix and pass after.