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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New cop idea: ensure fields that reference authorized types are null: true #132

Open
stevecrozz opened this issue Apr 25, 2023 · 1 comment

Comments

@stevecrozz
Copy link

The default graphql-ruby approach to unauthorized objects is to replace them with null. In order for that to work, the field declarations referring to these types must be null: true

Do you think it is possible to create a cop to make sure that all fields that reference types have null: true?

@DmitryTsepelev
Copy link
Owner

Hey!

We need a way to understand from AST that field has policy. We already do a similar thing for node types using authorized?: https://github.com/DmitryTsepelev/rubocop-graphql/blob/master/lib/rubocop/cop/graphql/not_authorized_node_type.rb.

If there's something on the field level (i.e. field :user, UserType, null: false, policy: UserPolicy) — it should be possible, if it's only in the code — will be way harder

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