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

Authorization rules can't compare enum property with context #5126

Open
jbhurruth opened this issue May 14, 2024 · 3 comments
Open

Authorization rules can't compare enum property with context #5126

jbhurruth opened this issue May 14, 2024 · 3 comments
Labels
bug report Something isn't working confirmed Confirmed bug

Comments

@jbhurruth
Copy link

Describe the bug
We have a requirement to check that a node's enum property in a list of enum values that we provide in the context object. When attempting something like the following schema definition we get the error Invalid argument: filter, error: Value \"$context.enum_list\" does not exist in \"Choice\" enum.

Is this a bug or is there another sneaky way to achieve this?

Type definitions

  enum Choice {
    A
    B
    C
  }
  type Example @authorization(
    filter: [{
      where: { node: { enum_IN: "$context.enum_list"} }
    }]
  ) {
    enum: Choice!
  }

To Reproduce
Steps to reproduce the behavior:

  1. Run a server with the above scheme
  2. See error on schema validation

Expected behavior
I would expect the validation to ignore scenarios like this since there's no way at validation time that the types could be checked.

System (please complete the following information):

Additional context
We're already trying to work around the inability to compare two node properties across multiple connections in an authorization rule.

@jbhurruth jbhurruth added the bug report Something isn't working label May 14, 2024
@neo4j-team-graphql
Copy link
Collaborator

Many thanks for raising this bug report @jbhurruth. 🐛 We will now attempt to reproduce the bug based on the steps you have provided.

Please ensure that you've provided the necessary information for a minimal reproduction, including but not limited to:

  • Type definitions
  • Resolvers
  • Query and/or Mutation (or multiple) needed to reproduce

If you have a support agreement with Neo4j, please link this GitHub issue to a new or existing Zendesk ticket.

Thanks again! 🙏

@neo4j-team-graphql neo4j-team-graphql added the confirmed Confirmed bug label May 14, 2024
@neo4j-team-graphql
Copy link
Collaborator

We've been able to confirm this bug using the steps to reproduce that you provided - many thanks @jbhurruth! 🙏 We will now prioritise the bug and address it appropriately.

@angrykoala
Copy link
Member

Hi @jbhurruth

Until this is fixed on our side, you should be able to use a string instead of an enum as a workaround

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug report Something isn't working confirmed Confirmed bug
Projects
Status: Medium priority
Development

No branches or pull requests

3 participants