Requiring auth header for introspection queries
See original GitHub issueI’m wondering if there’s a way to allow introspection queries only when a valid authorization header is passed.
I have introspection disabled outside development, but our client app needs to fetch the schema to be used in code generation for the iOS Apollo client as described here: https://www.apollographql.com/docs/ios/downloading-schema.html
Currently it looks like I can only enable or disable configuration via a boolean introspection
option passed in the config to the ApolloServer
constructor.
I’d like to allow the client developer access to that introspection query if they include a valid internal token in the auth header. Is that possible?
Issue Analytics
- State:
- Created 5 years ago
- Reactions:18
- Comments:19 (3 by maintainers)
Top Results From Across the Web
Authentication and authorization - Apollo GraphQL Docs
There are many patterns for providing authentication credentials, including HTTP headers and JSON web tokens. The example below extracts a user token from...
Read more >How to remove authentication for introspection query in Graphql
I am using node index.js to start the app. So, the app is expecting Authorization header (JWT token) to be present all the...
Read more >9 Ways to Secure Your Graph - Khalil Stemmler
Slow or failing queries? Manage public schema access? Handling deprecations safely? Malicious actors? Well-known GraphQL exploits?
Read more >OpenID Connect & OAuth 2.0 API - Okta Developer
scope, openid is required for authentication requests. ... you must include the client_id as a query parameter when calling the /introspect endpoint.
Read more >Introspection - Hot Chocolate - ChilliCream GraphQL Platform
Introspection is what enables GraphQL's rich tooling ecosystem as well ... While clients can still issue introspection queries, ... Headers.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
It is not possible at the moment but I’m also looking for something similar. Ideally
introspection
should be changed to be abool
orfunction that receives the request as
contextand returns
true/false`.@nether-cat Would this be a valid way of protecting JUST the introspection query? I still want certain unauthorized queries to pass, like a
login
.This plugin is currently checking for 3 things:
__schema
.__type
.__schema
or__type
is found in the query.Am I missing any obvious loopholes? Is there a better way to do this now?
NOTE: Invalid authorization headers may pass this check but are caught in my context middleware, where if there is an authorization header, it is validated.