Skip to content

feat(plugins): add GateProve safety boundary & hash-chained action ledger plugin - #3410

Open
AAH20 wants to merge 6 commits into
apache:masterfrom
AAH20:feat/gate-prove-safety-plugin
Open

feat(plugins): add GateProve safety boundary & hash-chained action ledger plugin#3410
AAH20 wants to merge 6 commits into
apache:masterfrom
AAH20:feat/gate-prove-safety-plugin

Conversation

@AAH20

@AAH20 AAH20 commented Aug 17, 2026

Copy link
Copy Markdown

Summary

Adds gate_prove, a native safety boundary and hash-chained Action Ledger plugin for MITRE Caldera operations.

Problem Solved

When running automated adversary emulation against enterprise or staging infrastructure, executing high-blast abilities (such as T1562 Impair Defenses, T1070 Indicator Removal, or T1485 Data Destruction) without strict safety controls creates acute operational risk and potential production downtime.

This plugin introduces a zero-trust safety boundary:

  1. never_equate_intent_to_approval: true: High planner confidence or automated execution does not authorize destructive techniques.
  2. Simulation Fallback: Unapproved destructive abilities automatically default to safe simulation mode without mutating underlying systems.
  3. HITL Prove Token: Destructive execution requires an authorized cryptographic token (CALDERA_PROVE_TOKEN).
  4. Append-Only Action Ledger: Every ability evaluation, receipt, and hash is recorded into an append-only JSONL ledger with SHA-256 chain verification for audit compliance (SOC 2, ISO 27001, NIST CSF).
  5. Atomic Kill-Switch: Immediate freeze of operation ability dispatch via environment variable (CALDERA_KILL_SWITCH=1) or file sentinel (artifacts/KILL).

Testing & Validation

  • Added plugins/gate_prove/tests/test_gate_prove.py verifying safe ability allowance, destructive technique simulation, HITL prove token validation, and SHA-256 ledger hash-chain integrity (all unit tests passing).

Upstream & Production Context

Maintained by A2Z SOC for safe purple-team adversary emulation, Cyber Risk Quantification (CRQ), and SOC 2 Type II audit readiness.

For teams deploying adversary emulation requiring safety audits or purple team sprints:

Copilot AI lite review requested due to automatic review settings August 27, 2026 14:11

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Warning

Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.

Introduces the new gate_prove plugin to enforce a deterministic “Gate/Prove” safety boundary for Caldera ability dispatch, including audit logging via a hash-chained action ledger, plus wiring Caldera’s dispatch paths through the new governor.

Changes:

  • Added gate_prove plugin implementation (service, authorization leases, ledger, attestation, trust contract) plus JSON schemas and README.
  • Added unit tests covering safety decisions, lease enforcement, intent binding, ledger hash-chain integrity, and attestation verification.
  • Integrated dispatch enforcement by routing manual commands and cleanup links through Operation.apply() (now GateProve-aware).

Reviewed changes

Copilot reviewed 15 out of 15 changed files in this pull request and generated 9 comments.

Show a summary per file
File Description
plugins/gate_prove/app/gate_prove_svc.py Core policy engine: kill-switch, destructive-technique gating via leases, intent binding, link governance
plugins/gate_prove/app/ledger.py Append-only SHA-256 hash-chained JSONL ledger + chain verification
plugins/gate_prove/app/authorization_lease.py HMAC-based scoped authorization lease issuing/verifying
plugins/gate_prove/app/attestation.py Signed evidence bundle generation + verification
plugins/gate_prove/app/trust_contract.py Operation intent digesting, building, and validation
plugins/gate_prove/app/ability_manifest.py AI-generated ability manifest + provenance validation and stable hashing
plugins/gate_prove/app/schema.py Decision dataclass and destructive technique patterns
plugins/gate_prove/hook.py Plugin enable hook registers gate_prove_svc configured via env vars
plugins/gate_prove/tests/test_gate_prove.py Unit test suite for the plugin behavior and integrity properties
plugins/gate_prove/schemas/*.schema.json Machine-readable schemas for intent + ability manifest contracts
plugins/gate_prove/conf/default.yml Default plugin configuration values
plugins/gate_prove/README.md Plugin documentation and usage guidance
app/service/rest_svc.py Manual command dispatch now goes through Operation.apply()
app/objects/c_operation.py Centralized dispatch path now consults GateProve before enqueuing links

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +22 to +31
def __init__(
self,
prove_token: str = "",
ledger: OperationLedger | None = None,
ledger_path: str = "artifacts/caldera_action_ledger.jsonl",
manifest_validator: AbilityManifestValidator | None = None,
authorization_key: str = "",
attestation_key: str = "",
) -> None:
self.prove_token = prove_token or os.environ.get("CALDERA_PROVE_TOKEN", "")
Comment on lines +54 to +69
def evaluate_ability(
self,
operation_id: str,
ability_id: str,
technique_id: str,
technique_name: str = "",
approved: bool = False,
offered_token: str = "",
simulate: bool = False,
ability_manifest: dict[str, Any] | None = None,
provenance: dict[str, Any] | None = None,
cleanup: bool = False,
authorization_lease: str = "",
ability_digest: str = "",
target: str = "",
) -> AbilityDecision:
Comment on lines +19 to +20
INSTANT_AUDIT_CTA = "https://a2zsoc.com/productized-services#caldera-arsenal-tripwire"
CONSULTATION_CTA = "https://a2zsoc.com/consultation"
Comment on lines +39 to +43
compliance_mapping: list[str] = field(
default_factory=lambda: ["NIST_CSF_DE.CM", "SOC2_CC7.2", "ISO_27001_A.12.6.1"]
)
instant_audit: str = INSTANT_AUDIT_CTA
consultation: str = CONSULTATION_CTA
Comment on lines +293 to +296
elif str(manifest.get("privilege", "")) != str(
intent.get("range", {}).get("privilege_ceiling", "")
):
binding_errors.append("ability privilege does not match the operation intent ceiling")
Comment on lines +21 to +29
def _load(self) -> None:
self.entries = []
with open(self.path, "r", encoding="utf-8") as f:
for line in f:
line = line.strip()
if line:
data = json.loads(line)
self.entries.append(data)
self._last_hash = data.get("receipt_hash", self._last_hash)
Comment on lines +41 to +42
ledger_id = str(uuid.uuid4())
ts = time.time()
Comment on lines +61 to +64
if self.path:
self.path.parent.mkdir(parents=True, exist_ok=True)
with open(self.path, "a", encoding="utf-8") as f:
f.write(json.dumps(payload, sort_keys=True) + "\n")
authorization_lease: str = "",
ability_digest: str = "",
target: str = "",
) -> AbilityDecision:
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.

3 participants