Skip to content

[Proposal] Add Wasm-based Cedar policy engine#362

Draft
andreaTP wants to merge 1 commit into
cedar-policy:mainfrom
andreaTP:cedar-wasm
Draft

[Proposal] Add Wasm-based Cedar policy engine#362
andreaTP wants to merge 1 commit into
cedar-policy:mainfrom
andreaTP:cedar-wasm

Conversation

@andreaTP
Copy link
Copy Markdown

Hi 👋 and thanks for the great project!

This is a first attempt at a pure-Java Cedar executor using WebAssembly without shipping native libraries. The Cedar Rust crate is compiled to wasm32-unknown-unknown and executed on the JVM via Chicory Redline, which AOT-compiles the Wasm module to native code for all supported platforms at build time(takes very long but runtime performance are really good), on any unsupported platform it fallback to pure Java generated by Chicory.

Performance looks reasonable for a first iteration — within 2-3x of JNI for realistic workloads, with room for improvement.

  • CedarWasm/wasm-build/ — Rust crate compiled to Wasm
  • CedarWasm/core/ — Java module (CedarEngine API + 15 tests)
  • CedarWasm/benchmark/ — JMH side-by-side comparison with JNI

See CedarWasm/README.md for build and benchmark instructions.

The main advantage of this approach is portability: a single jar works on all platforms with no native library management, no cross-compilation toolchain, and no JNI making it significantly easier to ship and maintain.

Would there be interest in moving this forward?

Compiles the Cedar Rust crate to WebAssembly and runs it via Chicory
Redline — eliminating native library cross-compilation while keeping
competitive performance with the JNI implementation.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.

1 participant