Skip to main content

CCS Runtime Verifier — Reference Implementation

Project description

CCS Runtime Verifier — Reference Implementation

This is the public reference implementation of the CCS (Command Control Standard) runtime verification layer.

What is CCS?

CCS defines a standard protocol for out-of-process runtime verification of AI agent commands. Unlike in-process filters that share the process space they police, CCS enforces a strict process boundary between the agent and its verifier — providing a stronger trust boundary for security-critical deployments.

Architecture

┌─────────────────┐       ┌──────────────────────┐
│   Agent (MCP)   │◄─────►│  CCS Verifier (OOB)  │
│                 │  gRPC  │                      │
│  - LLM calls    │       │  - Rule evaluation    │
│  - Tool invokes │       │  - Threat detection   │
│  - Data flows   │       │  - Audit logging      │
└─────────────────┘       └──────────────────────┘
     In-process                Out-of-process

Deployment Modes

In-Process (Recommended for most use cases): Use the Verifier class for immediate, synchronous verification. This is the simplest way to add CCS protection to your agent.

Out-of-Process (Advanced): Use VerifierClient + VerifierServer for a separate verifier process with full isolation. This provides stronger security guarantees (verifier survives agent crashes, independent memory space). Note: gRPC transport is currently a stub and will be implemented in a future release.

Quick Start

from ccs_verifier import Verifier, Command
from ccs_verifier import SSRFRule, RCERule, CredentialLeakRule

# Create verifier with built-in rules
verifier = Verifier(rules=[SSRFRule(), RCERule(), CredentialLeakRule()])

# Verify a command before execution
cmd = Command(
    agent_id="agent-001",
    tool="shell_exec",
    params={"command": "rm -rf /tmp/data"},
)

result = verifier.verify(cmd)
if result.allowed:
    # Command is safe, proceed with execution
    await execute(cmd)
else:
    # Command blocked: reason logged with signed receipt
    print(f"Blocked: {result.block_reason}")
    print(f"Receipt: {result.receipt}")  # Tamper-evident audit record

Built-in Rules

The package includes three built-in security rules:

  • SSRFRule: Blocks requests to dangerous URL schemes (file://, gopher://, dict://) and blocked hosts (cloud metadata endpoints, localhost).
  • RCERule: Detects dangerous shell patterns (rm -rf /, piped commands, command substitution).
  • CredentialLeakRule: Detects attempts to exfiltrate secrets (API keys, private keys, tokens).

Custom Rules

Implement the Rule protocol to create custom verification rules:

from ccs_verifier import Rule, Command, RuleResult, Verdict

class MyCustomRule:
    name = "my_custom_rule"

    def evaluate(self, command: Command) -> RuleResult:
        # Your custom logic here
        if is_dangerous(command):
            return RuleResult(
                rule_name=self.name,
                verdict=Verdict.DENY,
                reason="Custom rule triggered",
            )
        return RuleResult(rule_name=self.name, verdict=Verdict.ALLOW)

Verification Result

Each verification returns a VerificationResult with:

  • verdict: ALLOW, DENY, or ESCALATE
  • block_reason: Human-readable reason if blocked
  • rule_results: Detailed results from each rule evaluation
  • receipt: HMAC-SHA256 signed audit receipt covering trace_id, verdict, timestamp, tool, params hash, and rule summary
  • verified_at: Unix timestamp of verification

The receipt provides a tamper-evident audit trail, ensuring verification results cannot be modified after the fact.

Audit Log

The verifier maintains an in-process audit log of all verifications:

for entry in verifier.audit_log:
    print(f"{entry.trace_id}: {entry.verdict.value} at {entry.verified_at}")

Async API

For async applications, use averify():

result = await verifier.averify(cmd)

Key Interfaces

  • Verifier: High-level synchronous/asynchronous verifier (recommended)
  • VerifierClient: Client for out-of-process verification (requires running server)
  • VerifierServer: Server for out-of-process verification
  • Command: Standard command representation per CCS spec
  • VerificationResult: Result with signed audit receipt
  • Rule: Pluggable rule interface (SSRF, RCE, credential, etc.)

Academic References

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ccs_verifier-0.2.0.tar.gz (10.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ccs_verifier-0.2.0-py3-none-any.whl (10.7 kB view details)

Uploaded Python 3

File details

Details for the file ccs_verifier-0.2.0.tar.gz.

File metadata

  • Download URL: ccs_verifier-0.2.0.tar.gz
  • Upload date:
  • Size: 10.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.14

File hashes

Hashes for ccs_verifier-0.2.0.tar.gz
Algorithm Hash digest
SHA256 b2224400c40b9895a29c365366c6f837c3870ffc2fff2314dd19e49c4036f016
MD5 b0ee6cc8a7ef75ff104e2a2708a0f931
BLAKE2b-256 49f7fa5074ac303350978cde2e23abdd659d07e9e786f9cc17c7b889e5a15f91

See more details on using hashes here.

File details

Details for the file ccs_verifier-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: ccs_verifier-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 10.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.14

File hashes

Hashes for ccs_verifier-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ba1688bfae77cf38dc21405d42af9b1c4c6e197087b7bf133975348d880fe98f
MD5 51bd438720618ca1f31157ee7cffc8b6
BLAKE2b-256 4aa3e6fe468da6fc8964af453e452885280d2a55bb3d8c6d897b963b8a3451af

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page