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

Undefined values incorrectly retained for refs that contain variables (generic rule refs) #303

Closed
anakrish opened this issue Aug 28, 2024 · 0 comments · Fixed by #304
Closed
Labels
bug Something isn't working

Comments

@anakrish
Copy link
Collaborator

Undefined values are incorrectly retained and show up in output in the following rego:

package test

import rego.v1

principal := input.principal
action := input.action

p[principal][action] := 1 if {
  some a in []					    
}

q[principal][action] contains 1 if {
  some a in []					    
}

prodiuces

{
  "result": [
    {
      "expressions": [
        {
          "value": {
            "p": {
              "\"<undefined>\"": {}
            },
            "q": {
              "\"<undefined>\"": {
                "\"<undefined>\"": []
              }
            }
          },
          "text": "data.test",
          "location": {
            "row": 1,
            "col": 1
          }
        }
      ]
    }
  ]
}
@anakrish anakrish added the bug Something isn't working label Aug 28, 2024
anakrish added a commit that referenced this issue Aug 29, 2024
Handle undefined values correctly in ordered-else. Previously an undefined value
in one of the blocks could cause the entire rule to evaluate to undefined.

Handle undefined values correctly in generic rule refs to prevent them from
propagating to output.

Signed-off-by: Anand Krishnamoorthi <anakrish@microsoft.com>
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