Skip to content

Percent-encode deepObject parameter wire output#132

Merged
mromaszewicz merged 1 commit into
oapi-codegen:mainfrom
mromaszewicz:fix/issue-131
May 19, 2026
Merged

Percent-encode deepObject parameter wire output#132
mromaszewicz merged 1 commit into
oapi-codegen:mainfrom
mromaszewicz:fix/issue-131

Conversation

@mromaszewicz
Copy link
Copy Markdown
Member

Closes: #131

MarshalDeepObject emitted raw bytes for values, map keys, and paramName. Previously masked by oapi-codegen v2.6.0's client re-encoding via url.Values.Encode(); v2.7.0 stopped re-encoding (PR #2307), exposing the bug as 400s against RFC3986-compliant servers and silent query-string injection from '&' in values.

The fix passes values, each path segment, and the paramName through url.QueryEscape, matching the v2.6.0-effective behavior. Adds TestDeepObject_URLEncoding (51 sub-cases) covering reserved chars, non-ASCII, emoji, control bytes across values, map keys, and param names. Documents the unmarshal-side ambiguity for literal [ ] in keys (inherent to the deepObject format, matches qs/Rails behavior).

Closes: oapi-codegen#131

MarshalDeepObject emitted raw bytes for values, map keys, and paramName.
Previously masked by oapi-codegen v2.6.0's client re-encoding via
url.Values.Encode(); v2.7.0 stopped re-encoding (PR #2307), exposing
the bug as 400s against RFC3986-compliant servers and silent
query-string injection from '&' in values.

The fix passes values, each path segment, and the paramName through
url.QueryEscape, matching the v2.6.0-effective behavior. Adds
TestDeepObject_URLEncoding (51 sub-cases) covering reserved chars,
non-ASCII, emoji, control bytes across values, map keys, and param
names. Documents the unmarshal-side ambiguity for literal [ ] in keys
(inherent to the deepObject format, matches qs/Rails behavior).
@mromaszewicz mromaszewicz requested a review from a team as a code owner May 19, 2026 13:52
@mromaszewicz mromaszewicz merged commit 17de1dd into oapi-codegen:main May 19, 2026
14 checks passed
@mromaszewicz mromaszewicz deleted the fix/issue-131 branch May 19, 2026 13:55
@mromaszewicz mromaszewicz added the bug Something isn't working label May 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

deepObject query parameters are not URL-encoded (regression visible with oapi-codegen v2.7.0)

1 participant