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

Add source location to PrincipalConstraint, ActionConstraint and ResourceConstraint #521

Open
2 tasks
john-h-kastner-aws opened this issue Dec 19, 2023 · 1 comment · Fixed by #808
Open
2 tasks
Assignees
Labels
backlog We hope to work on this in the future feature-request Request for a new feature

Comments

@john-h-kastner-aws
Copy link
Contributor

Category

Other

Describe the feature you'd like to request

We store source locations for Exprs, but not for TemplateBody, PrincipalConstraint, ActionConstraint, or ResourceConstraint. Adding source locations to these structs would allow us to include source locations in errors occurring in the policy scope or effecting a whole policy without a more specific location.

For example, the validator looks at scope constraints to for some specific errors. For example, we currently report this error:

  × policy set validation failed
  ╰─▶ validation error on policy `policy0`: unable to find an applicable action given the policy head constraints
  help: try replacing `==` with `in` in the principal clause

This error should be able to point to the principal clause, but we don't currently store that source location anywhere.

Describe alternatives you've considered

.

Additional context

.

Is this something that you'd be interested in working on?

  • 👋 I may be able to implement this feature request
  • ⚠️ This feature might incur a breaking change
@john-h-kastner-aws john-h-kastner-aws added pending-triage Hasn't been triaged yet feature-request Request for a new feature backlog We hope to work on this in the future and removed pending-triage Hasn't been triaged yet labels Dec 19, 2023
@john-h-kastner-aws john-h-kastner-aws self-assigned this Apr 18, 2024
@john-h-kastner-aws john-h-kastner-aws changed the title Add source location to TemplateBody and related structs Add source location to PrincipalConstraint, ActionConstraint and ResourceConstraint Apr 24, 2024
@john-h-kastner-aws
Copy link
Contributor Author

This was partially resolved by #808, which added source information to TemplateBody which is used to provide an imprecise source location for some validation errors that previous did not have one.

Some more work is needed to add source information to the individual scope constraints. Doing this will allow more precise errors messages in some cases.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backlog We hope to work on this in the future feature-request Request for a new feature
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant