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

Shield permissions only working properly with 'debug: true' #1520

Open
1 task done
0xPBIT opened this issue Aug 14, 2023 · 2 comments
Open
1 task done

Shield permissions only working properly with 'debug: true' #1520

0xPBIT opened this issue Aug 14, 2023 · 2 comments

Comments

@0xPBIT
Copy link

0xPBIT commented Aug 14, 2023

Bug report

  • I have checked other issues to make sure this is not a duplicate.

Describe the bug

  • shield permissions fails no matter the configuration or return value of the rule.
  • when setting debug to true, shield works exactly as intended

To Reproduce

  • configure shield as usual with these versions:
"graphql": "^16.7.1",
"graphql-middleware": "^6.1.35",
"graphql-shield": "^7.6.5",

Steps to reproduce the behavior, please provide code snippets or a repository:

  • here is my current shield configuration:
export const permissions = shield(
  {
    Query: {
      "*": allow,
    },
    Mutation: {
      "*": allow,
    },
  },
);

I receive this shield error:

"errors": [
    {
      "message": "Not Authorised!",
      "locations": [
        {
          "line": 2,
          "column": 3
        }
      ],
      "path": [
        "signIn"
      ],
      "extensions": {
        "code": "INTERNAL_SERVER_ERROR",
        "stacktrace": [
          "Error: Not Authorised!",
          "    at normalizeOptions (/Users/user/Documents/GitHub/webrec/node_modules/graphql-shield/cjs/shield.js:27:52)",
          "    at shield (/Users/user/Documents/GitHub/webrec/node_modules/graphql-shield/cjs/shield.js:40:31)",
          "    at Object.<anonymous> (/Users/user/Documents/GitHub/webrec/packages/server/src/permissions/index.ts:4:34)",

so I add debug: true to options and see what's going on, but now shield is working as defined in permissions.

Expected behavior

I expect the permissions for "*": allow to work.

Actual behaviour

The permissions only work when I have debug: true in options

@chimpwidablastuh
Copy link

Up, same problem in here! Thank you

@jiahui92
Copy link

you are right T_T

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

3 participants