Skip to main content
Irreversible write actions (ActionTier === 'write') or read/propose actions configured with requireNamedApproval: true never execute autonomously without explicit sign-off from a named individual human approver.

Why Named Individual IDs Matter

In src/registry.ts, isIndividualHumanId(id) explicitly rejects shared handles (team-*, group-*, ops-*, finance-*, security-*, channel-*, dl-*, @here, @channel, @everyone, and email lists). Registering a ToolPolicy with a group handle throws immediately at startup. This guarantees every production mutation carries single-person accountability in audit_ledger.approver_id.

Ticket Binding & Replay Protection

When a write request arrives without a signed approvalTicketId:
  1. GovernanceGateway validates that request.idempotencyKey is non-empty (blocking fail-closed otherwise).
  2. ApprovalGate.createOrGetPending() mints a short-lived ticket (30-minute default TTL) pinned to { agentId, toolName, inputSha256, idempotencyKey, assignedApprovers }.
  3. buildSlackApprovalCard(ticket) (src/slack-bot.ts) renders the exact agent, ticket ID, truncated inputSha256 digest, summary JSON, and named approvers with Approve & Execute (ta_approve) and Reject (ta_reject) actions.
  4. GovernanceGateway logs an approval_transition entry (decision: 'require_approval') and returns status: 'pending_approval'.

HMAC Verification & Webhook Handler

src/slack-bot.ts verifies Slack interactivity payloads before passing decisions to ApprovalGate:
  • verifySlackSignature() validates X-Slack-Request-Timestamp within a strict 300-second (5-minute) replay window.
  • Computes v0=${HMAC_SHA256(signingSecret, "v0:" + timestamp + ":" + rawBody)} and compares via crypto.timingSafeEqual.
  • createSlackWebhookHandler() maps Slack user IDs to internal individual approver IDs (slackUserToApproverId) and rejects unauthorized clickers (403 Forbidden).

Duplicate-Click & Parameter-Drift Protection

  • Payload tampering after approval: If arguments change between sign-off and execution retry, inputSha256 mismatches the approved ticket and execution blocks (ASI02, ASI03).
  • Duplicate click / retry replay: Calling gateway.execute() again with the same idempotencyKey and identical inputSha256 returns { status: 'executed', idempotentReplay: true, output } without re-running executor(request). Reusing an idempotencyKey with a modified payload is blocked as an idempotency conflict.