-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
[Pro/Enterprise] Pundit integration behaves differently than normal authorization when resolving connections/lists #5174
Comments
Hey! Sorry for the trouble and thanks for the detailed report. The only thing that came to mind was #4726, but that was released in graphql-pro v1.26.0, so it wouldn't have affected v1.24.6. I'll take a closer look and follow up here with what I find! |
Ok, I read your issue more closely and I think I've spotted the issue. In GraphQL-Ruby v2.1.0, I made the default setting However, that default setting was a bad choice (and maybe a mistake? #3994 (comment)), so in v2.1.7, I reverted the default to If this is the problem that's causing the issue you found, you have two options:
Want to give one of those a try? Let me know how it goes! |
Thank you, using v.2.1.7 fixes this! If only I read the bug fixes in the changelog, I could have saved us both time! |
I'm glad to hear it worked! Yeah, well, that feature release was a bit bumpy 😖 |
Describe the bug
We have a type that uses
pundits
as part of the authorization flow. When being resolved as a connection, in graphql version 2.0.24, the authorization check occurs. In graphql-ruby version2.1.0
this check no longer occurs.Versions
graphql
version:2.1.0
rails
(or other framework):7.0.8
other applicable versions (
graphql-batch
, etc):1.24.6
, and even1.29.4
was tested1.3.0
GraphQL schema
Include relevant types and fields (in Ruby is best, in GraphQL IDL is ok). Any custom extensions, etc?
GraphQL query
Example GraphQL query and response (if query execution is involved)
Steps to reproduce
def self.authorized?
method definition to intercept the authorized callself.authorized?
method will be hit-In graphql-ruby 2.1.0, query a connection_type from a resolver that uses a pundit
self.authorized?
will not be hitExpected behavior
The authorized checks should be identical between the 2 cases
Actual behavior
The authorized checks did not trigger
Additional context
I did some digging into this, especially since graphql-ruby 2.1.0 changes how connections get authorized, so I thought this was a problem on us. However, I found a file
lib/graphql/schema/field/scope_extension.rb
, in which I noticed some diverging behaviour between resolving a normalconnection
vs one whose objects usepundit_role
+pundit_policy_class
:The text was updated successfully, but these errors were encountered: