Repository navigation
feat(policy-engine): evaluate Cedar policies by default - #4417
Open
Boyina Gowtham (moah0911) wants to merge 1 commit into
Open
Boyina Gowtham (moah0911) wants to merge 1 commit into
Boyina Gowtham (moah0911) wants to merge 1 commit into
Conversation
The default host policy dispatcher rejected any manifest that declared a Cedar policy, so Python, Node and .NET hosts had to supply their own dispatcher. Rego invocations now reach the existing OPA dispatcher and Cedar invocations reach the in-process CedarBuiltinDispatcher from agent-control-spec. A manifest that declares both engines uses a router. The test and custom policy types still fail at construction. Add allow, deny and malformed-advice cases in Rust, Python, Node and .NET, and document the default behavior in tutorial 08. Malformed advice fails closed. The runtime reports policy_invocation_failed after folding the dispatcher error, while the Cedar dispatcher reports policy_output_invalid. Fixes microsoft#4374 Signed-off-by: moah0911 <stormshots0911@gmail.com>
Boyina Gowtham (moah0911)
requested review from
MohammadHaroonAbuomar,
liamcrumm and
Prayag (prayagupa)
as code owners
October 23, 2026 16:09
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
|
Welcome to the Agent Governance Toolkit! Thanks for your first pull request. |
PR Review Summary
Verdict: AI review comments are untrusted advisory output. The summary reports workflow-generated completion status only, not model-authored pass/fail claims. |
|
🟡 Contributor Check: MEDIUM
Automated check by AGT Contributor Check. |
This branch has not been deployed
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.
Related Issue
Fixes #4374
Problem & Solution
Problem. The default host policy dispatcher inspected every policy in a manifest and rejected any engine other than Rego. A Cedar policy was valid in the manifest schema and
agent-control-specalready shippedCedarBuiltinDispatcher, but Python, Node and .NET hosts hitdefault policy dispatcher supports only Rego policiesunless they wrote a dispatcher. The Python workaround was a customPolicyDispatcherover cedarpy.Solution.
default_host_policy_dispatcher_with_limitsnow accepts Rego and Cedar policies. Rego invocations keep the existing OPA path, includingACS_OPA_PATHselection and bundle behavior. Cedar invocations go to the in-processagent_control_spec::CedarBuiltinDispatcher, so advice validation and fail-closed behavior come from the engine that already implements the Cedar contract. A manifest that declares both engines gets a small routing dispatcher that forwardsevaluateandwarmby invocation type. Manifests withtestorcustompolicies still fail at construction because no bundled evaluator exists for them. The error message now saysonly Rego and Cedar.The public API and result shape are unchanged. A host-supplied
policy_dispatcherstill overrides the default.Impact on Your Work
A Cedar manifest now evaluates with no custom dispatcher on Python, Node and .NET. Rego-only manifests take the same dispatcher path as before. Hosts that need a different Cedar engine can still pass their own dispatcher.
Timeline
None.
Alternatives Considered
testandcustompolicies in the default dispatcher. Rejected. There is no bundled evaluator for them, and accepting the manifest would move the failure to evaluation.Type of Change
Package(s) Affected
Governance & security:
Shared / other:
Other: the Python, Node and .NET SDKs under
policy-engine/sdk/.Testing
Unit Testing
New tests in
policy-engine/sdk/rust/src/host/tests.rs:@idreason) and malformed advice through the default dispatcher.runtime_error:policy_output_invalid.New tests in
policy-engine/sdk/python/tests/test_native_runtime.py:AgentControl.from_nativewith no policy dispatcher.only Rego and Cedar.New cases in
policy-engine/sdk/dotnet/tests/AgentControlSpecification.Tests/Program.csandpolicy-engine/sdk/node/test/native-runtime.test.mjscover the same allow, deny and malformed-advice policies.Manual Testing
All commands ran on Linux x86_64 with OPA 0.70.0 on
ACS_OPA_PATH.cargo test -p agent_control_specificationpassed every suite (54 lib tests plus the integration suites).pytest sdk/pythonpassed 308 tests with 42 skipped.dotnet build AgentControlSpecification.slnsucceeded with 0 warnings and 0 errors, anddotnet run --project tests/AgentControlSpecification.Testspassed.npm run build:testthennode --test test/native-runtime.test.mjspassed 21 tests.cargo fmt --all -- --checkandcargo clippy -p agent_control_specification --all-targets -- -D warningspassed.ruff checkon the changed Python test file reports no new findings. The file's 7 existing findings are unchanged.cspellon added lines found 0 issues. The docs link checker found 0 broken links and the frontmatter checker found 0 findings.validate_manifestand evaluates to deny for the blocked input and allow otherwise.The malformed-advice cases fail closed with
runtime_error:policy_invocation_failed. That is the runtime's §12.3 fold of the dispatcher error. The Cedar dispatcher itself reportsruntime_error:policy_output_invalid, and the Rust test asserts both layers.Checklist
Attribution & Prior Art
The Cedar evaluator comes from the existing
agent-control-specdependency. No third-party code was added.AI Assistance
Qoder (AI coding assistant) prepared the implementation and ran the Rust, Python, .NET and Node test suites at my request. I authorized the submission and will handle review comments.
IP, Patents, and Licensing