Command replay (a class of call, not one reported incident)
TRUNCATE TABLE with CASCADE: how to stop it
What happens
TRUNCATE TABLE with CASCADE. The call below tries to drop or empty a database table. The agent sends it through its Bash tool, and it involves Postgres.
The call
psql -c "TRUNCATE TABLE orders CASCADE;"
Tool: Bash. The replay uses placeholder tokens and hosts only.
Fix it without us
Do not grant the TRUNCATE privilege to the agent's role, and do not make that role the owner of the tables, because owners can truncate, and CASCADE reaches every table that has a foreign key to the target. Keep point-in-time recovery on and test a restore.
What KYA does
Replay result: Stopped. In the replay test, the local hook denies the call and names the rule.
Rule sql-drop, first stopped in version 0.33.0.
The hook is local and advisory. It fails open: if kya breaks or times out, the call goes ahead.
Install
For Claude Code, the host this replay ran on:
/plugin marketplace add The-Pixel-Boys/shield-kya
/plugin install kya@shield-kya
For any host:
npm i -g @shield-agent/kya@latest && kya start