Repository navigation
Conversation
Form encoding folded any parameter named key_N into key whenever key already existed, even if key_N was an authentic parameter from the request rather than a normalized duplicate alias. Record generated duplicate aliases during Form.Decode and only fold those back during Form.Encode, allowing parameters like address_1 alongside address to keep their distinct names and values.
Contributor
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 #8347
Summary of Changes
Form encoding previously folded any parameter named
key_Nintokeywheneverkeyalready existed in the request, even whenkey_Nwas a distinct, authentic parameter from the input (such asaddress=home&address_1=apt5).pkg/fuzz/dataformat/kv.go:duplicateAliases map[string]duplicateAliastoKV(and cloned inKV.Clone()) to explicitly remember generated duplicate aliases.Lookup(key string) (any, bool)onKV.pkg/fuzz/dataformat/form.go:Form.Decode, record generated duplicate alias keys (key_1,key_2, ...) viasetDuplicateAlias()and ensure alias naming does not collide with existing parameter names in the request.Form.Encode, only fold keys that were marked as duplicate aliases back into repeated base parameters. Authentic parameter names that matchkey_Nare preserved verbatim.TestFormDecodeEncode_KeepsParametersNamedLikeNormalizedKeys,TestFormEncode_DuplicateParameterAliasAfterClone,TestFormDecodeEncode_DuplicateParametersWithAliasNameCollision, andTestFormDecodeEncode_DuplicateParametersKeepOrderinpkg/fuzz/dataformat/form_test.go.TestQueryComponentKeepsParametersNamedLikeDuplicateAliasesandTestQueryComponentFuzzesDuplicateParameterAliasinpkg/fuzz/component/query_test.go.TestBodyFormComponentKeepsParametersNamedLikeDuplicateAliasesinpkg/fuzz/component/body_test.go.All tests in
pkg/fuzz/...pass cleanly.Summary by CodeRabbit