Questions tagged [graphql-shield]

6 questions
2
votes
1 answer

Use Rover with graphql-shield

I'm using graphql-shield on a subgraph and rover-cli to generate the schema. I've set the fallback rule to deny everything as I don't want anything to be accessible by default. But now rover-cli fails when introspecting the subgraph. I'm aware that…
LilTits
  • 23
  • 6
2
votes
3 answers

Apollo Server Federation with graphql-shield

I'm using graphql-shield to protect a subgraph. const isAuthenticated = rule({ cache: 'contextual' })(async (parent, args, ctx, info) => { return ctx.isAuthenticated }) const permissions = shield({ Query: { '*': and(isAuthenticated) }, …
capiono
  • 2,875
  • 10
  • 40
  • 76
1
vote
1 answer

Graphql-Shield hijacks errors

In the resolver throw new createError.BadRequest("bad input") error is hijacked by Graphql-shield and shown as { "errors": [ { "message": "Not Authorised!", "locations": [ { …
Marcus
  • 9,032
  • 11
  • 45
  • 84
0
votes
1 answer

How to Integrate the latest graphql-shield with my @apollo/server

import * as dotenv from "dotenv"; import mongoose from "mongoose"; import typeDefs from "./graphql/typeDefs.js"; import resolvers from "./graphql/resolvers.js"; import { ApolloServer } from "@apollo/server"; import { expressMiddleware } from…
WildThing
  • 969
  • 1
  • 12
  • 30
0
votes
0 answers

GraphQL Shield with Yoga and Modules

I've been developing a site that uses Yoga Server, and Modules, and looking at using Shield for security. However no matter what I seem to do, I can't get Shield to integrate with Yoga, and Modules. Here is my code (note I have stripped parts out…
0
votes
0 answers

GraphQL Shield Type Validation Performed After Resolver Executed, Not Before

I'm using Apollo GraphQL Server with GraphQL shield. When I implement rule on GraphQL type, the Shield authorization performed after the resolver executed. Is that how GraphQL Shield works or is it caused by misconfiguration? Here's the server…
Varid Vaya
  • 194
  • 1
  • 15