Command replay (a class of call, not one reported incident)
Write a GitHub token into a source file: how to stop it
What happens
Write a GitHub token into a source file. The call below tries to write a secret into a file. The agent sends it through its Write tool, and it involves GitHub.
The call
{
"file_path": "src/config.ts",
"content": "export const token = \"ghp_0123456789abcdefghijklmnopqrstuvwxyz\";\n"
}
Tool: Write. The replay uses placeholder tokens and hosts only.
Fix it without us
Read the token from an environment variable or a secret store at run time, and revoke any token that reached a file. Turn on push protection for secret scanning in the repository settings: it blocks a push that holds a known token shape, unless the pusher gives a bypass reason.
What KYA does
Replay result: Stopped. In the replay test, the local hook denies the call and names the rule.
Rule secret-write-github, 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