Skip to content

fix: Filter out http-bound members from schema passed to payload serializer#1892

Closed
haydenbaker wants to merge 1 commit intosmithy-lang:mainfrom
haydenbaker:hb/body-member-schema--fix
Closed

fix: Filter out http-bound members from schema passed to payload serializer#1892
haydenbaker wants to merge 1 commit intosmithy-lang:mainfrom
haydenbaker:hb/body-member-schema--fix

Conversation

@haydenbaker
Copy link
Contributor

@haydenbaker haydenbaker commented Feb 23, 2026

Context:

  • When a member has both @httpHeader and @idempotencyToken, the header is serialized correctly but the body also had that same member populated (with a different value)
  • The payload serializer (e.g. JsonShapeSerializer) iterates schema members (not input keys), finds the member is undefined, sees @IdempotencyToken, and generates a fresh UUID bound to the request body (not the header)
    • If the server rejects unknown fields in a request, then the request will be rejected and will never be processable
  • The root cause is that HttpBindingProtocol.serializeRequest() passes the full schema to the payload serializer including http-bound members (headers, params, etc)
    • The delete input[memberName] trick mostly works, but not for fields that get special treatment in the payload serializer
      • In this case, @idempotencyToken breaks it because the serializer treats undefined + @idempotencyToken as "generate a value."

Description of changes:

  • This adds filterMembers(cacheKey, predicate) to NormalizedSchema as a wrapper that overrides structIterator() so that a "view" of the schema can be passed (without explicit copying)
    • It's also cached, this is just an optimization to not recompute the view every time
  • This method is used in HttpBindingProtocol to give the payload serializer a view of the schema that excludes HTTP-bound members, so that it doesn't try to consume already bound members
  • There may be a better way to do this, but I'll leave that to the team to figure out if this isn't sufficient (I didn't want to make a super disruptive change that could have higher surface area)

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@haydenbaker haydenbaker requested a review from a team as a code owner February 23, 2026 22:56
@kuhe kuhe self-assigned this Feb 23, 2026
@kuhe
Copy link
Contributor

kuhe commented Feb 23, 2026

Thanks, I'll take a look soon, and add some changes & tests as needed.

@kuhe
Copy link
Contributor

kuhe commented Feb 24, 2026

will be fixed in #1893

@kuhe kuhe closed this Feb 24, 2026
@kuhe
Copy link
Contributor

kuhe commented Feb 24, 2026

A fix was released in https://www.npmjs.com/package/@smithy/core/v/3.23.5.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants