Skip to content

Unsafe var in object reports location of object, not the var #7935

@anderseknert

Description

@anderseknert
package play

obj := {
    "foo": "bar",
    "baz": qux,
}

In the example above, qux is unsafe and is correctly reported as such:

1 error occurred: policy.rego:3: rego_unsafe_var_error: var qux is unsafe

But qux is not located on line 3 but 5. This doesn't matter much for a trivial case like this, but can be quite annoying when defining large objects in e.g. tests, and having an accidentally unsafe var result in an error without a correct location.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions