fix: reject unsafe URL path segments in the 4.x SDK - #726
Closed
gjtorikian wants to merge 1 commit into
Closed
gjtorikian wants to merge 1 commit into
gjtorikian wants to merge 1 commit into
Conversation
Dot segments can be normalized into a different endpoint, making an identifier capable of retargeting a destructive request. URL quoting alone cannot prevent this because '.' and '..' remain unescaped. Empty identifiers and bare dot segments now raise ValueError before any HTTP request. Slashes, question marks, hashes, and percent signs in path identifiers are encoded rather than interpreted as URL structure. Callers must pass raw identifiers; pre-encoded values are double-encoded. This applies the VULN-1272 remediation to the requests-based 4.x SDK.
Contributor
|
Contributor
Author
|
Closing: this PR targets |
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.
Description
.or...get_user('a/b')request URL.This is the approved VULN-1272 adaptation for the requests-based
4.xbranch. The finding'ssrc/workos/_base_client.pyand pipes/groups/authorization resource layout is not present on this branch.Compatibility
Path identifiers equal to
'','.', or'..'now raiseValueErrorbefore any HTTP request. Characters/,?,#, and%are percent-encoded rather than interpreted as URL structure. Callers must pass raw, not pre-encoded identifiers:a/bbecomesa%2Fb, and%2e%2ebecomes%252e%252e.Validation
python -m pytest: 224 passed (verified baseline: 200; 24 new cases), with existing deprecation warnings.black --check .: clean.flake8 . --count --select=E9,F7,F82 --show-source --statistics: zero findings.Documentation
No WorkOS API reference or endpoint contract changes. The intentional SDK input-handling behavior change is documented above and in the helper docstring for release-note visibility.