Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect mutation to options object #332

Open
vjrngn opened this issue Oct 26, 2023 · 5 comments
Open

Incorrect mutation to options object #332

vjrngn opened this issue Oct 26, 2023 · 5 comments

Comments

@vjrngn
Copy link

vjrngn commented Oct 26, 2023

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
   }
...
}
@simoneb
Copy link
Member

simoneb commented Oct 27, 2023

Thanks for catching this. What kind of bad behavior is the deletion of the domain property causing?

@simoneb
Copy link
Member

simoneb commented Nov 21, 2023

Closing for lack of response from the OP

@simoneb simoneb closed this as not planned Won't fix, can't repro, duplicate, stale Nov 21, 2023
@vjrngn
Copy link
Author

vjrngn commented Dec 5, 2023

Apologies for not getting back quick enough. We are using the options object in other part of our application - so passing it around on service start. This mutation caused a bug in a dependent service.

@simoneb
Copy link
Member

simoneb commented Dec 5, 2023

Can you send a PR please? I'll reopen the issue

@simoneb simoneb reopened this Dec 5, 2023
@vjrngn
Copy link
Author

vjrngn commented Dec 7, 2023

Sure thing! Travelling at the moment and don't have access to a computer. Will raise one after I'm back home :)

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

No branches or pull requests

2 participants