Skip to content

Add demo-04 (context enforcement) and demo-05 (attribute enforcement)#20

Merged
imran-siddique merged 2 commits into
mainfrom
add-context-and-attribute-demos
Jul 20, 2026
Merged

Add demo-04 (context enforcement) and demo-05 (attribute enforcement)#20
imran-siddique merged 2 commits into
mainfrom
add-context-and-attribute-demos

Conversation

@imran-siddique

Copy link
Copy Markdown
Contributor

What

Two new runnable demos that extend the enforcement story past demo-01's tool-name gating. Demos 1-3 are the trust chain (enforce, tamper, verify); these add a second axis, showing that Cedar can decide a tool call on more than the tool's name.

  • demo-04 — context-aware enforcement. The same tool (write_file) is allowed under workflow_id="invoice-run" and denied under workflow_id="chat-freeform", same arguments. Authorization tracks the declared call context, not the model's stated intent.
  • demo-05 — attribute-based enforcement. A tool that is not BAA-covered (context.baa_covered == false) is refused by a single forbid guardrail that overrides the baseline permit. One rule covers every non-BAA-covered tool in the catalog, present and future.

Together with demo-01 they show three ways a call gets denied: by identity (name), by context (workflow), and by attribute (compliance/BAA).

How it's built

  • Reuses the existing server/server.py filesystem tools and the established demo layout (cmcp-config.yaml, catalog.json, policies/, call.py, run.py, run.sh).
  • Software-only under CMCP_DEV_MODE=1; no hardware required.
  • Both scoped strictly to shipped capabilities in cmcp-runtime 0.3.0 (Cedar permit/forbid on action + context, signed TRACE claim). No dependence on Draft/Phase-1.5 features (response inspection, session sensitivity).
  • Wired into demo.py (options 4 and 5) and the root README.md.

Test

Verified end to end against cmcp-runtime 0.3.0 on Windows (Python 3.12):

  • python demo-04-context-enforcement/run.py — allow / 403 deny / allow, signed claim.
  • python demo-05-compliance-domain/run.py — allow / allow / 403 deny, signed claim.
  • python demo.py --no-pause — all five demos pass.

🤖 Generated with Claude Code

imran-siddique and others added 2 commits July 20, 2026 11:53
Demos 1-3 are the trust chain (enforce, tamper, verify). This adds a
second axis: the same tool is allowed in one workflow and denied in
another, so authorization tracks the declared call context rather than
the tool's identity or the model's stated intent.

- write_file under workflow_id="invoice-run" is permitted
- the identical write_file under workflow_id="chat-freeform" is denied
  (default-deny; no permit matches WriteFile outside invoice-run)
- read_file is permitted in any workflow (only the write capability is scoped)
- both the allow and the deny are committed to the signed audit chain

Uses the shared filesystem MCP server and runs software-only under
CMCP_DEV_MODE=1. Wired into demo.py (option 4) and the root README.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
A third axis of enforcement alongside tool identity (demo-01) and call
context (demo-04): the policy decides on the tool's compliance attributes.

- write_file, read_file (compliance_domain=clinical, baa_covered=true) allowed
- list_dir (compliance_domain=external-analytics, baa_covered=false) denied
- the deny comes from a single guardrail: forbid ... when context.baa_covered
  == false, which overrides the baseline permit. One rule covers every
  non-BAA-covered tool in the catalog, present and future.

Runtime derives compliance_domain and baa_covered from the catalog entry.
Software-only under CMCP_DEV_MODE=1. Wired into demo.py (option 5) and README.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@imran-siddique
imran-siddique merged commit c051fef into main Jul 20, 2026
3 checks passed
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