Skip to content

response.To aliases request desired state and context #314

Description

@immanuwell

response.To says it copies request state into the response, but it currently reuses the same Desired and Context pointers.

That means a function can mutate the original request just by updating the response after To(...). This is easy to hit in normal SDK usage because functions commonly call response.To(...) and then add desired resources or context entries.

Repro:

  1. Build a request with Desired and Context.
  2. Call rsp := response.To(req, ttl).
  3. Mutate rsp.Desired or rsp.Context.
  4. req changes too.

Expected: To should deep copy request state before returning the response.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions