Repository navigation
Match urlencoded parameter names in filter_post_data_parameters - #1066
Merged
kevin1024 merged 1 commit intoOct 25, 2026
Merged
Conversation
Form bodies percent-encode parameter names as well as values, so a parameter such as "api:key" is sent as "api%3Akey" and was never matched by filter_post_data_parameters=["api:key"], leaving the value in the cassette. Fall back to the decoded name when the raw name doesn't match, which keeps already-encoded names in existing configs working. Fixes #686 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Merged
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.
Fixes #686
filter_post_data_parameterscompares the configured names against the raw bytes of a form body. Form bodies are urlencoded, so a parameter likeapi:keygoes over the wire asapi%3Akey(anduser nameasuser+name, non-ASCII names as%XXsequences) and never matches. The value ends up in the cassette, which is what the filter is supposed to prevent.This decodes the name with
unquote_pluswhen the raw name isn't in the replacements and checks again. The raw name is still checked first, so anyone who worked around this by configuringapi%3Akeykeeps working. Values are left alone: a callable still gets the raw value and replacement values are written as given, same as before. Query parameter filtering already works on decoded names (it goes throughparse_qsl), so this makes the two consistent.I added unit tests for the decoded-name case (including a non-ASCII name and
+for spaces) and for the already-encoded workaround, plus an integration test that records a urlencoded POST withfilter_post_data_parameters=["api:key"].This touches the same block as the open PRs for #660 (#1017, #1021, #1039, #1050) and #1004, so whichever lands second will need a small rebase.
I used Claude Code to write this change.