[Proposal] Add Wasm-based Cedar policy engine#362
Draft
andreaTP wants to merge 1 commit into
Draft
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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-unknownand 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 WasmCedarWasm/core/— Java module (CedarEngineAPI + 15 tests)CedarWasm/benchmark/— JMH side-by-side comparison with JNISee
CedarWasm/README.mdfor 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?