cedar-policy / cedar

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

Add parsing APIs to FFI #854

Open khieta opened 3 weeks ago

khieta commented 3 weeks ago

Category

User level API features/changes

Describe the feature you'd like to request

The FFI currently focuses on authorization and validation. It also supports parsing indirectly via the enabled flag in ValidationSettings (enabled=false means just parse the schema and policy set), but it would be convenient to support parsing more directly. The WASM and Java bindings both need this functionality, and built their own support. I suspect we just want to pull what WASM is doing directly into the ffi code -- see cedar-wasm/policies_and_templates.rs and cedar-wasm/schema_and_entities_and_context.rs.

Making a separate issue from #757 because if I keep increasing the scope of that issue it will never get done 😄

Describe alternatives you've considered

No response

Additional context

No response

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

cdisselkoen commented 2 weeks ago

+1 I think most of the functions that are today Wasm-only should be pulled into ffi in general, so that other bindings can make use of the same functions

khieta commented 2 weeks ago

Also possibly in scope: APIs to convert between different formats (e.g. JSON vs. Cedar-syntax schemas)

john-h-kastner-aws commented 2 weeks ago

Note from #882: the wasm version of these functions return strings, but with this change we should update them to use the DetailedError struct.