Repository navigation
fix(extraction): refuse non-int RegexExtractionStrategy pattern from untrusted requests - #2654
Merged
Merged
Conversation
…untrusted requests An untrusted body with a non-int pattern (string, list, dict) crashed __init__ with a TypeError, which the server returned as a 500. Reject it with UntrustedConfigError (400) instead. Also store pattern as a plain int so dump() holds no enum object, and fix the constructor docstring, which named a non-existent 'patterns' argument. Follow-up to #2588.
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.
Follow-up to #2588.
pattern(string, list, dict, bool) crashedRegexExtractionStrategy.__init__with a TypeError and returned a 500._clamp_untrustednow rejects it withUntrustedConfigError, so the server returns a 400. This was already broken before fix(extraction): keep RegexExtractionStrategy patterns through dump()/load() #2588.self.patternis stored as a plain int, sodump()holds a normal number, not the_Benum object.patternsargument that does not exist. It now documentspatternandcustom.Tests: 5 new cases in
tests/unit/test_regex_strategy_serialization.py. They fail without the fix and pass with it. Unit + security suites: 552 passed. The 2 failures (test_getattr_removed_from_source,test_asyncio_subprocess_rce_attempt) also fail on develop.