Recover (RC) · Authorization
Authorization at the client side layer
deterministic · Outside the model's reasoning
How do I get back to a known-good state and not repeat this?
What this cell does
Restore local hook config from VCS, verify file ownership and ACLs, reinstall pre-commit hooks, verify Claude Code is on the patched version.
Artifacts (1)
agent-restore-authorization-localview on GitHub#!/usr/bin/env bash
# ABOUTME: Local authorization-rebuild runbook. Clears immutability, restores hook from VCS, reapplies ACLs, reinstalls pre-commit.
# ABOUTME: Run from the repo root; the script reads controls/authorization/client-side/ as the source of truth.
set -euo pipefail
if [[ $# -lt 2 ]]; then
echo "Usage: agent-restore-authorization-local <AGENT_NAME> <INCIDENT_ID>" >&2
exit 64
fi
AGENT_NAME="$1"
INCIDENT_ID="$2"
SOURCE_DIR="${SOURCE_DIR:-$(pwd)/controls/authorization/client-side}"
if [[ ! -d "$SOURCE_DIR" ]]; then
echo "REFUSING: source-of-truth dir not found: $SOURCE_DIR" >&2
echo "Run from a repo checkout that contains controls/authorization/client-side/." >&2
exit 1
fi
# 1. Clear the immutable bit set during Interventions.
chattr -i /etc/agents/hooks/pre_tool_use.sh 2>/dev/null || true
# 2. Restore the hook config from source.
cp "$SOURCE_DIR/pre_tool_use.sh" /etc/agents/hooks/pre_tool_use.sh
chmod 0755 /etc/agents/hooks/pre_tool_use.sh
chown root:root /etc/agents/hooks/pre_tool_use.sh
# 3. Restore agent settings from source.
if [[ -r "$SOURCE_DIR/settings.json" ]]; then
cp "$SOURCE_DIR/settings.json" "/etc/agents/$AGENT_NAME/settings.json"
chmod 0644 "/etc/agents/$AGENT_NAME/settings.json"
fi
# 4. Re-install pre-commit if a config exists at the repo root.
if [[ -r .pre-commit-config.yaml ]] && command -v pre-commit >/dev/null 2>&1; then
pre-commit install >/dev/null 2>&1 || true
fi
# 5. Verify Claude Code is on the patched line (May 2026 precedence patch
# requires v2.1.40 or later; verify via --version).
if command -v claude >/dev/null 2>&1; then
CLAUDE_VERSION="$(claude --version 2>/dev/null | head -1)"
echo "Claude Code: $CLAUDE_VERSION"
echo "Required: 2.1.40 or later (May 2026 PreToolUse precedence patch)."
fi
logger -t agent-recovery -p user.notice \
"$(jq -n \
--arg event "authorization_restored_local" \
--arg agent "$AGENT_NAME" \
--arg incident "$INCIDENT_ID" \
--arg actor "$(whoami)" \
--arg ts "$(date -Iseconds)" \
'{event:$event, agent:$agent, incident:$incident, actor:$actor, ts:$ts}')"
echo "Local authorization restored for $AGENT_NAME"
Cell notes
Restorations, Authorization / Client-side
Precondition. Interventions L2-C2 has fired (deny-all hook applied, immutable bit set, agent killed). Restorations identity row complete (the agent has a fresh credential to start with after the rebuild).
Authority. On-call.
Tooling
- - Git access to the repo containing
.claude/config in source. - -
chattrto clear the immutable bit set during Interventions. - -
pre-commitframework to re-install hooks.
Files in this directory
- -
agent-restore-authorization-local, runbook script. Clears the chattr +i, restores hook config fromgit checkout, verifies file ownership returned to operator account, re-installs pre-commit, checks Claude Code version against the May 2026 patched line.
Verification
# 1. Hook is restored (md5 matches source-of-truth)
md5sum /etc/agents/hooks/pre_tool_use.sh
md5sum controls/authorization/client-side/pre_tool_use.sh
# expected: identical
# 2. Hook ownership is operator account, not agent
ls -la /etc/agents/hooks/pre_tool_use.sh
# expected: owner root, group operators
# 3. Immutable bit cleared
lsattr /etc/agents/hooks/pre_tool_use.sh
# expected: 'i' attribute absent
# 4. Pre-commit is installed
cd <repo> && pre-commit run --all-files
# 5. Claude Code is on the patched line
claude --version
# expected: >= 2.1.40 (May 2026 PreToolUse precedence patch)
Common failure modes
- -
chattr +ileft over from intervention; restore fails to overwrite. The runbook clears it explicitly. - - Hook ownership returned to agent's user instead of operator. Verify after restore.
- - Claude Code on a pre-patch version. The "allow"-bypasses-"deny" regression is back in effect even after recovery.
Citation
NIST CSF 2.0 RC.RP-01, RC.IM-01. NIST AI RMF MANAGE 4.1. OWASP ASI02, ASI05.
Primary failure modes
Documented, not hypothetical. A control whose bypass is undocumented is worse than no control, because somebody trusted it.
- chattr +i remained from intervention; restore fails to overwrite
- hook ownership returned to agent's user instead of operator
Crosswalk
| NIST CSF 2 0 | RC.RP-01, RC.IM-01 |
|---|---|
| NIST AI RMF | MANAGE 4.1 |
| OWASP AGENTIC | ASI02, ASI05 |
Cite this cell:
https://agenticcovenants.com/recover/authorization/client-side/