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

AST: missing location in some rule head refs #6860

Open
anderseknert opened this issue Jul 5, 2024 · 3 comments
Open

AST: missing location in some rule head refs #6860

anderseknert opened this issue Jul 5, 2024 · 3 comments

Comments

@anderseknert
Copy link
Member

This was reported in Regal, but my brief investigation suggests that the issue originates in OPA. Regal expects each part of a ref to include a location. However, a policy like this:

package p

import rego.v1

a.b if true

a.b := true

Transforms to an AST where the first a.b has no ref locations, and the second a.b does.

rule.head.ref "a.b if true"

[
  {
    "type": "var",
    "value": "a"
  },
  {
    "type": "string",
    "value": "b"
  }
]

rule.head.ref "a.b := true"

[
  {
    "location": {
      "col": 1,
      "file": "p.rego",
      "row": 7,
      "text": "b3V0cHV0"
    },
    "type": "var",
    "value": "output"
  },
  {
    "location": {
      "col": 8,
      "file": "p.rego",
      "row": 7,
      "text": "InVzZXJLYXJtYSI="
    },
    "type": "string",
    "value": "userKarma"
  }
]

I believe this inconsistency is a bug.

@anderseknert anderseknert changed the title Missing location from rule head refs Missing location from some rule head refs Jul 5, 2024
@anderseknert anderseknert changed the title Missing location from some rule head refs AST: missing location in some rule head refs Jul 6, 2024
@kd-labs
Copy link
Contributor

kd-labs commented Jul 8, 2024

can I pick this up ?? ...it would be my first to contribute to opa codebase

@charlieegan3
Copy link
Contributor

Certainly @kd-labs! Let us know how if you run into any issues.

Reviewing https://github.com/open-policy-agent/opa/pull/5576/files might be a good place to start.

Copy link

stale bot commented Aug 8, 2024

This issue has been automatically marked as inactive because it has not had any activity in the last 30 days. Although currently inactive, the issue could still be considered and actively worked on in the future. More details about the use-case this issue attempts to address, the value provided by completing it or possible solutions to resolve it would help to prioritize the issue.

@stale stale bot added the inactive label Aug 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants