-
Notifications
You must be signed in to change notification settings - Fork 594
Open
Labels
MUSTP1: Non-negotiable, critical requirements without which the product is non-functional or unsafeP1: Non-negotiable, critical requirements without which the product is non-functional or unsafechoreLinting, formatting, dependency hygiene, or project maintenance choresLinting, formatting, dependency hygiene, or project maintenance choresplannedPlanned for future releasePlanned for future releasepluginstestingTesting (unit, e2e, manual, automated, etc)Testing (unit, e2e, manual, automated, etc)wxowxo integrationwxo integration
Milestone
Description
π§ͺ Summary
Sub-issue of #3735 β Test, harden, and document the Cedar Policy Plugin (plugins/external/cedar/) to bring it to production quality for the 1.0.0 release.
This plugin evaluates Cedar policies and a user-friendly custom-DSL on incoming requests to allow or deny tool invocations using RBAC-based decisions enforced via the cedarpy library. It supports both native Cedar policy syntax and a compact custom DSL mode for non-expert users.
π§± Area Affected
- Plugin:
plugins/external/cedar/β External policy-as-code enforcement via Cedar
βοΈ Context / Rationale
The plugin is listed as Priority 2 in the parent issue. It provides fine-grained, policy-as-code RBAC enforcement for tool and resource access, and is noted in the parent issue as requiring additional setup for testing (Cedar policy engine via cedarpy).
Current state:
- Plugin exists in
plugins/external/cedar/cedarpolicyplugin/plugin.pywith schema inschema.py - Plugin-local tests exist at
plugins/external/cedar/tests/test_cedarpolicyplugin.pybut are not integrated into the main gateway test suite - README covers Cedar and custom-DSL modes but may lack complete examples and limitation notes
- External dependency on
cedarpy; tests must account for its availability - Known TODOs: main test suite integration, mock policy testing, output redaction coverage
π Acceptance Criteria
Testing
- Unit tests: Create or expand
tests/unit/plugins/test_cedar_policy_plugin.pyin the main test suite:- Cedar mode:
Permitpolicy allows a matching principal/action/resource - Cedar mode:
Forbidpolicy denies a matching request - Custom DSL mode: role-based allow/deny decisions are evaluated correctly
- Missing or unavailable
cedarpydependency is handled gracefully (fail-open or clear error) - Invalid policy syntax raises a clear configuration error at load time
- Output redaction based on
view_redacted_outputvsview_full_outputkeywords
- Cedar mode:
- Integration tests: Test the plugin registered and active within the gateway pipeline:
- Plugin loads and activates without errors
- Tool calls are allowed/denied based on active Cedar policies
- Plugin coexists correctly with other active plugins
- Edge cases:
- Empty policy list (no policies defined)
- Principal with no matching role
- Action not listed in any policy
- Conflicting
PermitandForbidpolicies (verify Cedar precedence rules apply correctly) cedarpynot installed (verify documented failure mode)
Documentation
- README hardening: Expand
plugins/external/cedar/README.mdto include:- Full configuration reference for both
cedarandcustom_dslmodes - Complete working examples for both policy modes with expected outcomes
- Explanation of output redaction via
policy_output_keywordsandpolicy_redaction_spec - External dependency requirements (
cedarpy) and installation instructions - Known limitations and Cedar language version compatibility
- Full configuration reference for both
- Inline docstrings: Verify all public methods have complete docstrings meeting
interrogatestandards - Config docs: Ensure
plugins/config.yamlhas a complete example entry for this plugin
Hardening
- Config validation: Confirm
schema.pyrejects invalid policy structures at load time before the plugin activates - Missing config keys: Verify partial configs (missing keys) fall back cleanly to defaults
- Error handling: Plugin exceptions (including
cedarpyfailures) must not propagate to caller β confirm failure mode is documented and consistent - Logging: Ensure policy decisions are logged at appropriate levels; no sensitive payload data in logs
- Main test suite integration (stretch goal): Mirror or move
plugins/external/cedar/tests/test_cedarpolicyplugin.pyintotests/unit/plugins/for CI inclusion
Overall
- CI passes with no regressions
- All new tests added to the appropriate test suite
- Plugin manifest (
plugin-manifest.yaml) is accurate and complete
π Key Files
plugins/external/cedar/cedarpolicyplugin/plugin.pyβ Plugin implementationplugins/external/cedar/cedarpolicyplugin/schema.pyβ Configuration schemaplugins/external/cedar/cedarpolicyplugin/plugin-manifest.yamlβ Plugin manifestplugins/external/cedar/README.mdβ Plugin documentationplugins/external/cedar/tests/test_cedarpolicyplugin.pyβ Existing plugin-local testsplugins/external/cedar/examples/β Example configurationsplugins/config.yamlβ Plugin configurationplugins/AGENTS.mdβ Plugin development guidelines
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
MUSTP1: Non-negotiable, critical requirements without which the product is non-functional or unsafeP1: Non-negotiable, critical requirements without which the product is non-functional or unsafechoreLinting, formatting, dependency hygiene, or project maintenance choresLinting, formatting, dependency hygiene, or project maintenance choresplannedPlanned for future releasePlanned for future releasepluginstestingTesting (unit, e2e, manual, automated, etc)Testing (unit, e2e, manual, automated, etc)wxowxo integrationwxo integration