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

Auth cypher param dropped if no Authorization header causing exception instead of unauthorized error #280

Closed
mathix420 opened this issue Jun 26, 2021 · 0 comments · Fixed by #281
Labels
bug Something isn't working

Comments

@mathix420
Copy link
Contributor

The simplified schema used

type User {
    id: ID! @id
    publishedVideos: [Video!]! @relationship(type: "PUBLISHER", direction: OUT)
}

type Video {
    id: ID! @id
    publisher: User! @relationship(type: "PUBLISHER", direction: IN)
}

extend type Video @auth(rules: [{ where: { publisher: { id: "$jwt.sub" } } }])

Query used

query getVideos {
    videos {
        id
    }
}

Behavior

  • When passing an Authorization header with the JWT, everything is working fine.
  • Once the Authorization is removed, got the following error:
Expected parameter(s): this_auth_where0_publisher_id

DEBUG data
Authenticated test:

@neo4j/graphql:execute About to execute Cypher:

Cypher:
    [HIDDEN]
Params:
    {
      "this_auth_where0_publisher_id": "719dd44f-c7c6-422e-8bf8-41127c8a306e",
      "auth": {
        "isAuthenticated": true,
        "roles": [],
        "jwt": {
          [HIDDEN]
          "sub": "719dd44f-c7c6-422e-8bf8-41127c8a306e"
        }
      }
    } +0ms

Non-authenticated test:

@neo4j/graphql:execute About to execute Cypher:

Cypher:
    [HIDDEN]
Params:
{
  "auth": {
    "isAuthenticated": false,
    "roles": []
  }
} +10s

Expected behavior
Non-authenticated:

@neo4j/graphql:execute About to execute Cypher:

Cypher:
    [HIDDEN]
Params:
{
  "this_auth_where0_publisher_id": null,
  "auth": {
    "isAuthenticated": false,
    "roles": []
  }
} +10s
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant