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

Make parse_policy_or_template_to_est error for CST that aren't valid AST #952

Merged
merged 4 commits into from
Jun 7, 2024

Conversation

john-h-kastner-aws
Copy link
Contributor

The EST conversion does not apply the checks that we apply CST to EST conversion, and we don't want to duplicate all of them. For example, this function succeeded for expression using extension function with an incorrect call style like "1".ip() (cedar-policy/cedar-spec#341).

Effects policy_text_to_json in the WASM bindings.

Description of changes

Issue #, if available

Checklist for requesting a review

The change in this PR is (choose one, and delete the other options):

  • A change (breaking or otherwise) that only impacts unreleased or experimental code.

I confirm that this PR (choose one, and delete the other options):

  • Updates the "Unreleased" section of the CHANGELOG with a description of my change (required for major/minor version bumps).

I confirm that cedar-spec (choose one, and delete the other options):

  • Does not require updates because my change does not impact the Cedar formal model

The EST conversion does not apply the checks that we apply CST to EST
conversion, and we don't want to duplicate all of them. For example,
this function succeeded for expression using extension function with an
incorrect call style like `"1".ip()` (cedar-policy/cedar-spec#341).

Effects `policy_text_to_json` in the WASM bindings.

Signed-off-by: John Kastner <[email protected]>
Signed-off-by: John Kastner <[email protected]>

### Changed

- Update `policyTextToJson` so that it reliably errors for all policies that
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are these quoted names functions?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They're the JS binding function names from annotations like #[wasm_bindgen(js_name = "checkParseTemplate")]

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it. Thanks.

Copy link
Contributor

@shaobo-he-aws shaobo-he-aws left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

cedar-policy-core/src/est.rs Outdated Show resolved Hide resolved
@john-h-kastner-aws john-h-kastner-aws merged commit e79707a into main Jun 7, 2024
16 of 17 checks passed
@john-h-kastner-aws john-h-kastner-aws deleted the est-converison-note branch June 18, 2024 19:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants