cedar-policy / cedar

Implementation of the Cedar Policy Language
https://www.cedarpolicy.com
Apache License 2.0
892 stars 80 forks source link

Some authorization errors do not have source locations attached #1117

Open cdisselkoen opened 3 months ago

cdisselkoen commented 3 months ago

Before opening, please confirm:

Bug Category

Policy Evaluation

Describe the bug

485 claimed to provide source locations for evaluation errors. However, in at least some cases, public AuthorizationErrors backed by EvaluationError do not have source locations. We should investigate why this is; to my knowledge, these errors should have source locations attached.

Expected behavior

Authorization errors resulting from policy-evaluation errors should have source locations attached (for policies parsed from the Cedar policy syntax, not the JSON format).

Reproduction steps

  1. Grep for TODO(#485) in the code. This TODO was left in the code even though #485 was resolved. As of this writing, the TODO is at cedar-policy/src/tests.rs:3626.
  2. Uncomment the two lines that check for source locations, and rename the variable _err to err.
  3. cargo test --all-features
  4. The tests fail.

Code Snippet

No response

Log output

No response

Additional configuration

No response

Operating System

No response

Additional information and screenshots

No response