Repository navigation
fix(security): reject file:// URLs that name a host (1.0.2b7+ra.2) - #11
Merged
Merged
Conversation
SEC-2 file:// netloc hardening. workspace._workspace_io_path now rejects file:// URLs whose netloc is anything other than a bare drive letter. urlparse puts the drive in netloc for the two-slash form Windows CI builds (file://C:/...), and that is the only netloc we accept. Anything else fails closed with 403 instead of being resolved and tested against a host-layout-dependent allowlist: - file://server/share/x.txt (UNC) would otherwise resolve to the local path /share/x.txt - backslash paths put the whole remainder in netloc and used to collapse to the process cwd Regression tests assert the hostile forms -> 403, and assert that file://C:/... is NOT rejected as a host so the shape Windows actually sends keeps working. Guard only -- the version-sync gate lives in the companion chore/version-sync-gate PR.
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.
SEC-2 file:// netloc hardening at the HTTP surface.
workspace._workspace_io_pathnow rejectsfile://URLs whose netloc isanything other than a bare drive letter — a UNC host
(
file://server/share/x) or a backslash path (file://C:\\Users\\x) failsclosed with 403 instead of being resolved and containment-tested against a
host-layout-dependent allowlist.
Exploitability check on the shipped 1.0.2b7+ra.1:
/share/x(no drive): the existing allowlist alreadydenies it, so this half is defense in depth.
resolves to
.(the server process cwd). That is a host-absoluteinterpretation of a user-controlled query parameter landing on the server
working directory: exploitable, not defense in depth. That drives the
+ra.2 hotfix.
Tests: hostile host forms assert 403;
file://C:/...(the two-slash shapeWindows CI builds, where urlparse puts the drive in netloc) asserts it is
NOT rejected as a host.
Companion PR:
chore/version-sync-gate(release version-sync test + Makefileforce-run + publish SKILL fork note). This PR is the security half only.