Skip to content

Enforce requires scopes directive on types rule #2908

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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

spenserca
Copy link

🚨 IMPORTANT: Please do not create a Pull Request without creating an issue first.

Any change needs to be discussed before proceeding. Failure to do so may result in the rejection of
the pull request.

Description

Add a schema validation that checks all object types for the @requiresScopes directive. This will enforce that anyone who pushes to the federated graph will have to define and apply proper security to their data.

Fixes #2907

Type of change

Please delete options that are not relevant.

  • New feature (non-breaking change which adds functionality)

How Has This Been Tested?

I've included a spec.ts and test.ts file testing both the valid and invalid cases for the rule.

Test Environment:

  • OS:
  • @graphql-eslint/...:
  • NodeJS:

Checklist:

  • I have followed the
    CONTRIBUTING doc and the
    style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests and linter rules pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

Further comments

I'm fairly new to diving deep into graphql and federation, so if there are better alternatives or changes that should be made to this before being accepted, I'm open to discussion.

@spenserca spenserca marked this pull request as ready for review April 10, 2025 20:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

New Rule: Require "requiresScopes" directive on all object types
1 participant