Skip to content

RFC: Unified Policy Format for CI and AI Attestations #12

@colek42

Description

@colek42

Summary

Propose a unified policy format that works seamlessly for both:

  • witness-wrapper (CI pipelines)
  • witness-signer-mcp (AI agent attestations)

Problem Statement

Currently, organizations need to maintain separate policy configurations for:

  1. CI/CD pipelines using witness-wrapper
  2. AI agent workflows using witness-signer-mcp

This leads to:

  • Policy drift between environments
  • Duplicate maintenance effort
  • Inconsistent security postures

Proposed Architecture

┌─────────────────────────────────────────────────────────┐
│                  Unified Policy Format                   │
│                                                          │
│  steps:                                                  │
│    - name: test                                          │
│      type: validation                                    │
│      commands:                                           │
│        - pattern: "go test"                              │
│        - pattern: "npm test"                             │
│      attestors:                                          │
│        - command-run                                     │
│        - git                                             │
│      required_for: [ci, ai]                              │
│                                                          │
│    - name: lint                                          │
│      type: validation                                    │
│      commands:                                           │
│        - pattern: "golangci-lint"                        │
│        - pattern: "npm run lint"                         │
│      required_for: [ci, ai]                              │
│                                                          │
│    - name: coverage                                      │
│      type: quality-gate                                  │
│      threshold: 80                                       │
│      required_for: [ci]                                  │
│      optional_for: [ai]                                  │
└─────────────────────────────────────────────────────────┘
           │                            │
           ▼                            ▼
┌─────────────────────┐    ┌─────────────────────────────┐
│   witness-wrapper   │    │    witness-signer-mcp       │
│   (CI Pipeline)     │    │    (AI Agent)               │
│                     │    │                             │
│  - Runs in GHA/GL   │    │  - Runs in Claude Code      │
│  - Full attestation │    │  - Interactive attestation  │
│  - SLSA compliance  │    │  - Human-in-loop signing    │
└─────────────────────┘    └─────────────────────────────┘
           │                            │
           ▼                            ▼
┌─────────────────────────────────────────────────────────┐
│              Shared Verification Layer                   │
│                                                          │
│  witness verify --policy unified-policy.json             │
│                                                          │
│  - Same policy works for both CI and AI attestations    │
│  - Consistent security requirements                      │
│  - Single source of truth                                │
└─────────────────────────────────────────────────────────┘

Key Features

1. Semantic Step Types

Instead of exact command matching, use semantic types:

  • validation - linting, testing, type checking
  • quality-gate - coverage thresholds, complexity limits
  • security-scan - vulnerability scanning, secret detection
  • build - compilation, bundling

2. Environment-Specific Requirements

required_for: [ci]      # Only required in CI
required_for: [ai]      # Only required for AI agents
required_for: [ci, ai]  # Required in both
optional_for: [ai]      # Optional for AI, provides bonus trust

3. Command Pattern Matching

Use glob/regex patterns instead of exact strings:

commands:
  - pattern: "go test ./..."
  - pattern: "npm test"
  - pattern: "*jest*"

4. Shared Attestor Configuration

Common attestor settings that work in both contexts:

attestors:
  git:
    require_clean: true
    allowed_statuses: [untracked]
  command-run:
    capture_output: true

Benefits

  1. Single Policy Definition - One policy file governs both CI and AI
  2. Consistent Security - Same requirements enforced everywhere
  3. Flexible Enforcement - Different requirements per environment
  4. Easier Auditing - One place to review security requirements
  5. Reduced Drift - No policy synchronization needed

Implementation Phases

Phase 1: Policy Schema

  • Define unified YAML/JSON schema
  • Support for both exact and pattern matching
  • Environment-specific requirements

Phase 2: witness-wrapper Integration

  • Update witness-wrapper to read unified format
  • Generate witness policies from unified schema
  • Backwards compatibility with existing policies

Phase 3: witness-signer-mcp Integration

  • Update witness-signer-mcp to read unified format
  • Generate Rego policies from unified schema
  • Support for interactive policy creation

Phase 4: Tooling

  • Policy linter for unified format
  • Migration tool from existing policies
  • Documentation and examples

Questions for Discussion

  1. Should we support YAML, JSON, or both?
  2. How do we handle attestor-specific configuration differences?
  3. What's the migration path for existing policies?
  4. Should we support policy inheritance/composition?

Related Issues

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions