fix(proxy,server): audit Cedar exceptions; add global 500 handler (POLICY-003, NET-004) - #214
Merged
Merged
Conversation
…LICY-003, NET-004)
POLICY-003: Cedar backend exceptions now emit a fault audit entry
before re-raising, so misconfigured-policy incidents are traceable
in the audit chain instead of disappearing silently.
NET-004: Added a global Starlette exception handler that returns
{"error_code": "INTERNAL_ERROR"} without leaking exception class
names or messages to callers.
Closes #160, #180
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The per-workflow Cedar scope PR added workflow_id to call_tool(). The conformance test mock lambdas didn't accept **kwargs, causing TEE_FAULT on every tools/call in the conformance suite. Co-Authored-By: Claude Sonnet 4.6 <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.
Summary
faultaudit entry withpolicy_decision="fault"andexception_typedetail before re-raising. Previously these escaped silently with no audit trail._unhandled_error_handleras a global Starletteexception_handlers={Exception: ...}handler. Truly unhandled exceptions now return{"error_code": "INTERNAL_ERROR"}(HTTP 500) without leaking exception class names or messages.Test plan
test_cedar_exception_writes_fault_audit_entry— RuntimeError from Cedar backend produces one fault entry with correct policy_decision and exception_typetest_unhandled_exception_returns_generic_500— unhandled exception in /tools/list returns 500 without leaking detail🤖 Generated with Claude Code