Command replay (a class of call, not one reported incident)
Write a private key into the repo: how to stop it
What happens
Write a private key into the repo. The call below tries to write a secret into a file. The agent sends it through its Write tool, and it involves SSH keys.
The call
{
"file_path": "deploy/key.txt",
"content": "-----BEGIN OPENSSH PRIVATE KEY-----\nplaceholder\n"
}
Tool: Write. The replay uses placeholder tokens and hosts only.
Fix it without us
Keep private keys out of the repository: use ssh-agent, or a deploy key held in the secret store of your CI system. If a key reached a file, remove it from the host that trusts it and make a new one.
What KYA does
Replay result: Stopped. In the replay test, the local hook denies the call and names the rule.
Rule secret-write-privkey, 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