Skip to content
This repository was archived by the owner on Aug 29, 2018. It is now read-only.

Resolves #14 - Passes Feathers params to service hooks#15

Merged
marshallswain merged 1 commit intofeathersjs-ecosystem:masterfrom
intellect-collective:fix/14-feathers-params-service-hooks
Jun 22, 2017
Merged

Resolves #14 - Passes Feathers params to service hooks#15
marshallswain merged 1 commit intofeathersjs-ecosystem:masterfrom
intellect-collective:fix/14-feathers-params-service-hooks

Conversation

@thomas-p-wilson
Copy link
Copy Markdown
Contributor

Summary

Resolves the issue set forth in #14, where Feathers params specified in REST and Socket middleware are not passed through to the user service during authentication.

@marshallswain marshallswain requested a review from ekryski April 14, 2017 16:00
@daffl
Copy link
Copy Markdown
Member

daffl commented Apr 14, 2017

Thank you for the pull request. Is this fix working for you? The problem is that user services should discard the password field when params.provider is set (see https://github.com/feathersjs/generator-feathers/blob/master/generators/service/templates/hooks-user.js#L29) so there is no way for local authentication to compare password when passing it through. We could make a copy of params and omit(params, 'provider')

@thomas-p-wilson
Copy link
Copy Markdown
Contributor Author

thomas-p-wilson commented Apr 14, 2017 via email

@ekryski
Copy link
Copy Markdown
Member

ekryski commented Apr 14, 2017

I want to be very careful with this PR. There are potential side-effects (especially security ones) that could occur by passing feathers params to the users service during an authentication call.

As per my comment #14 (comment), the lack of params passing was done intentionally so that one can't call authenticate with query params and potentially get another user's id injected into their JWT access token.

If the use case seems legit, then we'll need to also make sure we omit params.query.

@thomas-p-wilson thomas-p-wilson force-pushed the fix/14-feathers-params-service-hooks branch 2 times, most recently from 302717f to 79075da Compare May 14, 2017 00:27
@ekryski
Copy link
Copy Markdown
Member

ekryski commented Jun 21, 2017

@thomas-p-wilson thanks for fixing this up. I'm okay to merge this PR but I still also feel like this is precisely the reason we have custom verifiers, if you need to do something "custom" other than username and password.

Second opinions from others are welcome otherwise I'll just merge this in a bit.

@thomas-p-wilson
Copy link
Copy Markdown
Contributor Author

thomas-p-wilson commented Jun 21, 2017 via email

@marshallswain
Copy link
Copy Markdown
Member

@thomas-p-wilson could you resolve the small conflict with the latest master?

@thomas-p-wilson
Copy link
Copy Markdown
Contributor Author

thomas-p-wilson commented Jun 22, 2017 via email

@thomas-p-wilson
Copy link
Copy Markdown
Contributor Author

thomas-p-wilson commented Jun 22, 2017 via email

@thomas-p-wilson thomas-p-wilson force-pushed the fix/14-feathers-params-service-hooks branch from 79075da to cff3852 Compare June 22, 2017 09:08
Comment thread src/verifier.js
const results = response.data || response
if (!results.length) {
debug(`a record with ${this.options.usernameField} of '${username}' did not exist`);
debug(`a record with ${usernameField} of '${username}' did not exist`);
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note this additional change. Master did not use the apparently new username constant defined on line 72. Figured it was a quick fix :)

@thomas-p-wilson
Copy link
Copy Markdown
Contributor Author

Rebased my PR. Tests passing. Should be good to go!

@marshallswain
Copy link
Copy Markdown
Member

Ha! This happened to me last night. It was weird. The tests passed in Travis. I pulled them down and they all failed. Wiped out node_modules and reinstalled, but it still failed. When I wiped out the entire project folder and re-cloned it worked fine.

Thanks. That was really fast!

@marshallswain marshallswain merged commit 7e12a27 into feathersjs-ecosystem:master Jun 22, 2017
@marshallswain
Copy link
Copy Markdown
Member

released as feathers-authentication-local@0.4.2. Thank you, @thomas-p-wilson!

@thomas-p-wilson
Copy link
Copy Markdown
Contributor Author

thomas-p-wilson commented Jun 22, 2017 via email

@ekryski
Copy link
Copy Markdown
Member

ekryski commented Jun 22, 2017

Thanks guys! Nice work!

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants