Skip to content

Incorrect mutation to options object #332

@vjrngn

Description

@vjrngn

Hey folks 👋🏼

I recently updated the package to 1.2.0 and looks like there's a bug that was introduced (link below)
https://github.com/nearform/fastify-auth0-verify/blob/master/index.js#L15C28-L15C28

My application sets the options.domain property but it is being deleted which is causing an bad behaviour.
Ideally, you would create a copy of the options object and leave user options untouched.

Didn't send a PR since this is a single line change. Happy to send a PR if that helps

Proposal:

function fastifyAuth0Verify(instance, options, done) {
  try {
    const optionsCopy = { ...options };
    let { domain, secret } = optionsCopy;

    if (domain) {
      delete optionsCopy.domain
   }
...
}

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