Skip to content

Receiver accept() method modifies its input parameter. #230

Closed

Description

@matejvasek

The receiver may destroy input payload.
For instance after calling receiver.accept(response.headers, response.data) the data member may end up as empty object.

https://github.com/cloudevents/sdk-javascript/blob/fba3294ce04a30be0e5ab551a1fa01727dc8d1f8/src/lib/bindings/http/validation/structured.js

Activity

  1. matejvasek commented on Jun 22, 2020

    @matejvasek
    ContributorAuthor

    /cc @lance

  2. lholmquist commented on Jun 24, 2020

    @lholmquist
    Contributor

    I'm not totally following from the link you posted. Would it be possible to post a small code example of what you are seeing?

  3. lance commented on Jun 24, 2020

    @lance
    Member

    @lholmquist the issue is here:

    . Even though the payload is assumed to be transformed by the parser here the parser in many cases is a "pass through" parser - doing nothing but returning the parameter. So we end up with the caller's payload object being modified.

  4. lholmquist commented on Jun 24, 2020

    @lholmquist
    Contributor

    ah, ok. sounds like a bug

  5. matejvasek commented on Jun 24, 2020

    @matejvasek
    ContributorAuthor

    @lance @lholmquist note that I reproduced this on the Lance's TS rework branch, I am going to try to reproduce this on master.

  6. matejvasek commented on Jun 24, 2020

    @matejvasek
    ContributorAuthor

    Yes, the "pass through" parser causes problem.

  7. matejvasek commented on Jun 24, 2020

    @matejvasek
    ContributorAuthor

    I would submit PR, but I won't since @lance is going to rewrite a lot of things.

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

    type/bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions