Skip to main content

Policy Bundles

CFA Policy Bundles are versioned, loadable YAML/JSON files that define governance rules — separating policy definition from code.

Why Policy Bundles?

  • Separation of concerns: Platform/security teams define policies in YAML; data teams reference them by version
  • Auditability: Every execution records which bundle version was active
  • CI/CD integration: cfa validate --policy-bundle policies/prod-v1.yaml
  • Versioned: Bundles have semantic versions (e.g., prod-v1.0)

Built-in Bundles

CFA ships with 3 bundles in the policies/ directory:

BundleFocusRulesSeverity
prod-v1.yamlBalanced safety & cost7Mixed
finops-strict-v1.yamlAggressive cost control5High
compliance-strict-v1.yamlRegulated industries7Critical

Bundle YAML Schema

policy_bundle:
version: "prod-v1.0"
description: "Production governance rules"
last_updated: "2026-06-06"
rules:
- name: forbid_raw_pii_in_silver_or_gold
condition: pii_in_protected_layer
action: replan
fault_code: GOVERNANCE_RAW_PII_IN_PROTECTED_LAYER
severity: critical
family: semantic
message: "PII detected without treatment in write to protected layer."
remediation:
- "Apply sha256() on PII columns before join"
- "Or use drop() to remove sensitive columns"

Available Conditions

10 built-in conditions mapped to StateSignature checks:

ConditionTrigger
pii_in_protected_layerPII in Silver/Gold without anonymization
missing_merge_keyWrite to Silver/Gold without merge_key
missing_partitionHigh-volume dataset without partition filter
sensitive_without_partitionSensitive dataset without partition
enforce_types_disabledType enforcement disabled on protected write
pii_without_policyPII present without no_pii_raw constraint
cost_budget_exceededCost exceeds configured ceiling
schema_mismatchOutput schema differs from contract
unauthorized_gold_writeUnauthorized Gold layer write
customUser-defined condition

Custom Conditions

from cfa.core.conditions import register_condition, build_condition

def my_custom_check(meta):
def check(sig):
return sig.domain == "finance" and len(sig.datasets) > 5
return check

register_condition("finance_large_join", my_custom_check)

Loading from Code

from cfa.policy.bundle import PolicyBundle, list_available_bundles
from cfa.policy import PolicyEngine

# List available
bundles = list_available_bundles("policies/")

# Load and use
bundle = PolicyBundle.from_yaml("policies/prod-v1.yaml")
engine = PolicyEngine.from_bundle("policies/prod-v1.yaml")

CLI Usage

cfa evaluate "intent" --policy-bundle policies/compliance-strict-v1.yaml