-
Notifications
You must be signed in to change notification settings - Fork 139
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’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(nestjs-query): effective authorizer on websocket connections #1160
Closed
asorian0
wants to merge
8
commits into
doug-martin:master
from
asorian0:feat/created-resolver-authorizer-unique-channel-per-user
Closed
feat(nestjs-query): effective authorizer on websocket connections #1160
asorian0
wants to merge
8
commits into
doug-martin:master
from
asorian0:feat/created-resolver-authorizer-unique-channel-per-user
+142
−54
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…lver-authorizer-unique-channel-per-user
…d delete subscriptions working
doug-martin
added a commit
that referenced
this pull request
Jul 24, 2021
* feat: authorizer applied to pub sub * feat(query-graphql): authorizer for websocket in resolvers * updating spaces to improve code review * feat: authorizer for create many * feat: authorizer applied to update subscriptions * feat: authorizer applied to delete subscriptions * fix: adding missing decorator to make authorizer applied to update and delete subscriptions working * feat: Enable authorizers on subscriptions * feat: Enable authorizers on subscriptions * example: Add authorized subscription example * fix: lock apollo versions until nestjs/graphql updates Co-authored-by: Armando Soriano <[email protected]>
Merged
This will be in |
doug-martin
added a commit
that referenced
this pull request
Jul 26, 2021
* feat: authorizer applied to pub sub * feat(query-graphql): authorizer for websocket in resolvers * updating spaces to improve code review * feat: authorizer for create many * feat: authorizer applied to update subscriptions * feat: authorizer applied to delete subscriptions * fix: adding missing decorator to make authorizer applied to update and delete subscriptions working * feat: Enable authorizers on subscriptions * feat: Enable authorizers on subscriptions * example: Add authorized subscription example * fix: lock apollo versions until nestjs/graphql updates Co-authored-by: Armando Soriano <[email protected]>
doug-martin
added a commit
that referenced
this pull request
Jul 27, 2021
* feat: authorizer applied to pub sub * feat(query-graphql): authorizer for websocket in resolvers * updating spaces to improve code review * feat: authorizer for create many * feat: authorizer applied to update subscriptions * feat: authorizer applied to delete subscriptions * fix: adding missing decorator to make authorizer applied to update and delete subscriptions working * feat: Enable authorizers on subscriptions * feat: Enable authorizers on subscriptions * example: Add authorized subscription example * fix: lock apollo versions until nestjs/graphql updates Co-authored-by: Armando Soriano <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Relates to #958, which is related to authorizer is not applied to subscriptions. This fact allows any legit user to sniff on any subscription operation, even if the data should be banned to that user.
Solution consists in creating an unique channel name based on data provided in authorizer, if any. If no authorizer is supplied, it behaves as of now.
Usage
Authorizer in your code, in this case we have populated the request with the claims from JWT, so we can bind the authorizer to unique "userId" value in order to make sure that only that user will be able to receive events created/update/delete which "receiverId" value is the same as "userId" value.
How it works
Basically it picks the authorizer object of type
Filter<MyDto>
and creates an unique string based on its contents. The function that handles that is onhelpers.ts
and it is calledgetUniqueNameForEvent
. This way it binds the event to an unique "channel", allowing to encapsulate for a single user or set of users some events.@doug-martin thanks for your work!