AuthZ and subscriptions #738
-
I got Here's a query that works great with AuthZ (fyi the
but this subscription authz rule doesn't seem to be working because it lets it subscribe without Authentication:
and also I tried putting the AuthZ rules on the event and that didn't stop an unauthenticated user from subscribing either:
Just wondering if it's implemented yet or I'm doing something wrong, or if this is an AuthZ issue and not a Pothos issue. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 5 replies
-
This is likely an authz issue. I've been thinking about removing this plugin from the docs. My experience with it has been poor, and when I looked into it's implementation I found several instances of object rules not being applied correctly. The Pothos plugin is extremely simple: https://github.com/hayes/pothos/blob/main/packages/plugin-authz/src/index.ts, it really just adds the rules to the extensions object for types/fields. Most of it is just about creating nice types, and all the actual logic is implemented by authz. I would strongly recommend the scope auth plugin instead. There is also an example of how to use graphql shield in the examples folder on GitHub if you prefer that. |
Beta Was this translation helpful? Give feedback.
This is likely an authz issue. I've been thinking about removing this plugin from the docs. My experience with it has been poor, and when I looked into it's implementation I found several instances of object rules not being applied correctly.
The Pothos plugin is extremely simple: https://github.com/hayes/pothos/blob/main/packages/plugin-authz/src/index.ts, it really just adds the rules to the extensions object for types/fields. Most of it is just about creating nice types, and all the actual logic is implemented by authz.
I would strongly recommend the scope auth plugin instead. There is also an example of how to use graphql shield in the examples folder on GitHub if you prefer that.