-
Notifications
You must be signed in to change notification settings - Fork 0
feat: POLICY-CONFIG-001 PR 8 — Policy configuration documentation #33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,118 @@ | ||
| --- | ||
| title: Policy Scoping | ||
| description: How CapiscIO's three-level policy scoping model (org → group → agent) enables granular trust and access control. | ||
| --- | ||
|
|
||
| # Policy Scoping | ||
|
|
||
| CapiscIO uses a **three-level scoping model** for policy configuration, providing flexible control over agent trust and access at every level of your organization. | ||
|
|
||
| ## Scope Levels | ||
|
|
||
| ``` | ||
| ┌─────────────────────────────────────────┐ | ||
| │ Org Policy │ Baseline for all agents | ||
| │ min_trust_level: DV │ | ||
| │ denied_dids: [did:web:blocked.ex] │ | ||
| ├─────────────┬───────────────────────────┤ | ||
| │ Group: PII │ Group: Public │ Named agent collections | ||
| │ min_trust: │ min_trust: "" │ | ||
| │ OV │ │ | ||
| ├──────┬──────┼───────────────────────────┤ | ||
| │ Agent│Override │ Per-agent overrides | ||
| │ EV │ │ | ||
| └──────┴──────┴───────────────────────────┘ | ||
| ``` | ||
|
|
||
| ### 1. Organization Scope (Baseline) | ||
|
|
||
| The **org-level policy** is the baseline that applies to every agent in your organization. It defines the minimum trust requirements, default access rules, and rate limits. | ||
|
|
||
| ```yaml | ||
| # capiscio-policy.yaml (org scope) | ||
| version: "1" | ||
| min_trust_level: "DV" | ||
| denied_dids: | ||
| - "did:web:known-bad-actor.example.com" | ||
| rate_limits: | ||
| - did: "did:web:high-volume.example.com" | ||
| rpm: 100 | ||
| ``` | ||
|
|
||
| ### 2. Group Scope (Named Collections) | ||
|
|
||
| **Policy groups** allow you to apply rules to named collections of agents. For example, you might create a "PII Handlers" group with stricter trust requirements, or a "Public APIs" group with more permissive settings. | ||
|
|
||
| Groups have a **precedence** value (lower = higher priority) that determines which group policy takes effect when an agent belongs to multiple groups. | ||
|
|
||
| ```yaml | ||
| # Group: pii-handlers (precedence: 10) | ||
| version: "1" | ||
| min_trust_level: "OV" | ||
| allowed_dids: | ||
| - "did:web:trusted-processor.example.com" | ||
| ``` | ||
|
|
||
| ### 3. Agent Scope (Per-Agent Overrides) | ||
|
|
||
| **Agent-level policies** provide the finest granularity. They override both org and group policies for a specific agent. Use these for agents with unique requirements. | ||
|
|
||
| ```yaml | ||
| # Agent: critical-payment-processor | ||
| version: "1" | ||
| min_trust_level: "EV" | ||
| operations: | ||
| - pattern: "payment.*" | ||
| min_trust_level: "EV" | ||
| allowed_dids: | ||
| - "did:web:payment-gateway.example.com" | ||
| ``` | ||
|
|
||
| ## Resolution Algorithm | ||
|
|
||
| When evaluating a policy decision, CapiscIO resolves the **effective policy** for each agent by merging policies in order: | ||
|
|
||
| 1. Start with the **org policy** (baseline) | ||
| 2. Apply **group policies** in precedence order (lowest precedence number first) | ||
| 3. Apply **agent-specific overrides** (highest priority) | ||
|
|
||
| The resolution is **deterministic**: given the same set of active policies, the resolved result is always identical. This is critical for audit and debugging. | ||
|
|
||
| ### Override Behavior | ||
|
|
||
| - **`min_trust_level`**: Narrower scope wins (agent > group > org) | ||
| - **`allowed_dids`**: Intersection (more specific scope restricts further) | ||
| - **`denied_dids`**: Union (denied at any scope = denied everywhere) | ||
| - **`rate_limits`**: Most specific scope wins per DID | ||
| - **`operations`** and **`mcp_tools`**: Most specific scope wins per pattern/tool name | ||
|
|
||
| ## Visibility and Auditability | ||
|
|
||
| Every policy resolution produces an **attribution trail** showing which scope contributed which rule. This is accessible via: | ||
|
|
||
| - **Resolved Policy endpoint**: `GET /v1/orgs/{orgId}/policy/agents/{agentId}/resolved` | ||
| - **Lineage endpoint**: `GET /v1/orgs/{orgId}/policy/agents/{agentId}/lineage` | ||
| - **Policy Context** (SDK): `capiscio policy context` | ||
|
|
||
| The resolved endpoint returns the effective policy for a specific agent. The lineage endpoint returns all policy documents that contributed to the resolution, in precedence order. | ||
|
|
||
| ## Trust Levels | ||
|
|
||
| CapiscIO defines six trust levels, each representing increasing assurance about an agent's identity: | ||
|
|
||
| | Level | Name | Meaning | | ||
| |-------|------|---------| | ||
| | (empty) | None | No trust requirement | | ||
| | `SS` | Self-Signed | Agent has a self-signed key | | ||
| | `REG` | Registered | Agent is registered in the registry | | ||
| | `DV` | Domain Validated | Agent's domain ownership is verified | | ||
| | `OV` | Organization Validated | Agent's organization is verified | | ||
| | `EV` | Extended Validation | Agent has undergone extended validation | | ||
|
|
||
| Trust levels are hierarchical: `EV > OV > DV > REG > SS > (none)`. | ||
|
|
||
| ## Next Steps | ||
|
|
||
| - [Configure Agent Policy](../how-to/configure-agent-policy.md) — YAML config walkthrough | ||
| - [Policy API Reference](../reference/policy-api.md) — Phase-one API endpoints | ||
| - [CLI Reference](../reference/cli/index.md) — `capiscio policy` commands |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,221 @@ | ||
| --- | ||
| title: Configure Agent Policy | ||
| description: How to write and deploy YAML-based policy configurations for your CapiscIO agents. | ||
| --- | ||
|
|
||
| # Configure Agent Policy | ||
|
|
||
| This guide walks you through writing, validating, and deploying YAML policy configurations. Policy configs define trust requirements, access rules, and rate limits for your agents. | ||
|
|
||
| ## Quick Start | ||
|
|
||
| ### 1. Create a Policy Config File | ||
|
|
||
| Create a file named `capiscio-policy.yaml` in your project root: | ||
|
|
||
| ```yaml | ||
| version: "1" | ||
| min_trust_level: "DV" | ||
| denied_dids: | ||
| - "did:web:known-bad-actor.example.com" | ||
| ``` | ||
|
|
||
| ### 2. Validate Locally | ||
|
|
||
| ```bash | ||
| capiscio policy validate -f capiscio-policy.yaml | ||
| ``` | ||
|
|
||
| ### 3. Deploy to Your Organization | ||
|
|
||
| Use the dashboard UI or the [Policy API](../reference/policy-api.md) to create and approve a policy proposal: | ||
|
|
||
| ```bash | ||
| # View current policy context | ||
| capiscio policy context --registry https://api.capisc.io --api-key $CAPISCIO_API_KEY | ||
| ``` | ||
|
|
||
| ## YAML Schema | ||
|
|
||
| ### Version | ||
|
|
||
| Every policy config must specify `version: "1"`. This is the current and only supported version. | ||
|
|
||
| ```yaml | ||
| version: "1" | ||
| ``` | ||
|
|
||
| ### Minimum Trust Level | ||
|
|
||
| Set a baseline trust requirement for all incoming agent requests: | ||
|
|
||
| ```yaml | ||
| min_trust_level: "DV" # Require domain validation or higher | ||
| ``` | ||
|
|
||
| Valid values: `""` (none), `SS`, `REG`, `DV`, `OV`, `EV` | ||
|
|
||
| ### DID Access Lists | ||
|
|
||
| Control which agents can interact with your agents by DID: | ||
|
|
||
| ```yaml | ||
| # Only these agents may call your agents | ||
| allowed_dids: | ||
| - "did:web:partner-a.example.com" | ||
| - "did:web:partner-b.example.com" | ||
|
|
||
| # These agents are always blocked | ||
| denied_dids: | ||
| - "did:web:known-bad-actor.example.com" | ||
| ``` | ||
|
|
||
| !!! warning "Mutual Exclusivity" | ||
| A DID cannot appear in both `allowed_dids` and `denied_dids`. The validator will reject such configurations. | ||
|
|
||
| ### Rate Limits | ||
|
|
||
| Define per-DID rate limits (requests per minute): | ||
|
|
||
| ```yaml | ||
| rate_limits: | ||
| - did: "did:web:high-volume-caller.example.com" | ||
| rpm: 100 | ||
| - did: "did:web:low-priority.example.com" | ||
| rpm: 10 | ||
| ``` | ||
|
|
||
| Rate limits generate **obligations** in policy decisions — the enforcement point is responsible for applying them. | ||
|
|
||
| ### Operation-Scoped Rules | ||
|
|
||
| Apply different trust/access rules to specific operations: | ||
|
|
||
| ```yaml | ||
| operations: | ||
| - pattern: "payment.*" | ||
| min_trust_level: "EV" | ||
| allowed_dids: | ||
| - "did:web:payment-gateway.example.com" | ||
| - pattern: "read.*" | ||
| min_trust_level: "" # No trust required for reads | ||
| ``` | ||
|
|
||
| Operations are matched against `input.action.operation` in policy evaluation. | ||
|
|
||
| ### MCP Tool-Scoped Rules | ||
|
|
||
| Apply rules to specific MCP tools exposed by your agent: | ||
|
|
||
| ```yaml | ||
| mcp_tools: | ||
| - tool: "database_query" | ||
| min_trust_level: "OV" | ||
| denied_dids: | ||
| - "did:web:untrusted.example.com" | ||
| - tool: "file_read" | ||
| min_trust_level: "DV" | ||
| ``` | ||
|
|
||
| MCP tool rules are matched against `input.action.mcp_tool` in policy evaluation. | ||
|
|
||
| ## Complete Example | ||
|
|
||
| ```yaml | ||
| version: "1" | ||
| min_trust_level: "DV" | ||
|
|
||
| allowed_dids: | ||
| - "did:web:trusted-partner.example.com" | ||
| - "did:web:internal-service.example.com" | ||
|
|
||
| denied_dids: | ||
| - "did:web:blocked-agent.example.com" | ||
|
|
||
| rate_limits: | ||
| - did: "did:web:trusted-partner.example.com" | ||
| rpm: 1000 | ||
| - did: "did:web:internal-service.example.com" | ||
| rpm: 500 | ||
|
|
||
| operations: | ||
| - pattern: "payment.*" | ||
| min_trust_level: "EV" | ||
| allowed_dids: | ||
| - "did:web:payment-processor.example.com" | ||
| - pattern: "admin.*" | ||
| min_trust_level: "OV" | ||
|
|
||
| mcp_tools: | ||
| - tool: "database_query" | ||
| min_trust_level: "OV" | ||
| - tool: "send_email" | ||
| min_trust_level: "EV" | ||
| allowed_dids: | ||
| - "did:web:notification-service.example.com" | ||
| ``` | ||
|
|
||
| ## Validation | ||
|
|
||
| ### CLI Validation | ||
|
|
||
| Validate your policy config before deploying: | ||
|
|
||
| ```bash | ||
| # Default file (capiscio-policy.yaml) | ||
| capiscio policy validate | ||
|
|
||
| # Custom file | ||
| capiscio policy validate -f my-policy.yaml | ||
|
|
||
| # JSON output for CI integration | ||
| capiscio policy validate -f my-policy.yaml --json | ||
| ``` | ||
|
|
||
| Exit code `0` means valid; non-zero means validation errors. | ||
|
|
||
| ### Validation Rules | ||
|
|
||
| The validator checks: | ||
|
|
||
| - **Version**: Must be `"1"` | ||
| - **Trust levels**: Must be one of `""`, `SS`, `REG`, `DV`, `OV`, `EV` | ||
| - **DID format**: All DIDs must start with `did:` | ||
| - **No duplicates**: A DID cannot appear twice in the same list | ||
| - **No cross-listing**: A DID cannot be in both `allowed_dids` and `denied_dids` | ||
| - **Rate limits**: RPM must be positive | ||
| - **Operations**: Pattern must not be empty | ||
| - **MCP tools**: Tool name must not be empty | ||
|
|
||
| ## Policy Lifecycle | ||
|
|
||
| ### 1. Create a Proposal | ||
|
|
||
| Policies go through a proposal workflow: | ||
|
|
||
| ``` | ||
| Create Proposal → Review → Approve → Active | ||
| ↘ Reject (with reason) | ||
| ``` | ||
|
|
||
| ### 2. Approval Activates Policy | ||
|
|
||
| When a proposal is approved, it becomes the active policy. The previously active policy is marked as superseded. | ||
|
|
||
| ### 3. Bundle Rebuild | ||
|
|
||
| After activation, the policy bundle is automatically rebuilt. Agents polling the bundle endpoint will pick up the new policy on their next refresh cycle. | ||
|
|
||
| ### 4. Enforcement | ||
|
|
||
| Policy enforcement follows the [enforcement mode](../concepts/enforcement.md) configured for your deployment: | ||
|
|
||
| - **EM-OBSERVE**: Violations logged but allowed (default) | ||
| - **EM-GUARD**: Violations blocked, PDP-unavailable allowed with warning | ||
| - **EM-STRICT**: All violations blocked, including PDP unavailability | ||
|
|
||
| ## Next Steps | ||
|
|
||
| - [Policy Scoping](../concepts/policy-scoping.md) — Org/group/agent scoping model | ||
| - [Policy API Reference](../reference/policy-api.md) — REST API for policy management | ||
| - [CLI Reference](../reference/cli/index.md) — `capiscio policy` commands | ||
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This section says to use “the dashboard UI or the CLI to create and approve a policy”, but the only documented
capiscio policyCLI commands here arevalidateandcontext(no create/approve). Please adjust the wording to match what’s currently supported (e.g., dashboard UI and/or Policy API endpoints).