Vendor replays
Coding agent risks with Git: replays and fixes
5 replays involve Git: 0 reported incidents and 5 command classes. Each one shows the call, a fix that needs no extra tool, and what KYA did in the replay.
Delete the main branch on the remote
Fix: Protect the default branch on the server (a GitHub branch protection rule or ruleset) and leave branch deletion and force pushes off. Administrators and bypass actors can skip these rules unless you enforce them for administrators, so the agent's token must not belong to either.
Replay result: Stopped.
Force push to a feature branch
Fix: Add a branch ruleset on the server that blocks force pushes, or set receive.denyNonFastForwards on a server you run yourself. A ruleset can be skipped by its bypass actors and by administrators unless you enforce it for them, so the agent's token must not belong to either.
Replay result: Stopped.
Force push to the main branch
Fix: Protect main on the server (a GitHub branch protection rule or ruleset), leave force pushes off, and require a pull request. Administrators and bypass actors can skip these rules unless you enforce them for administrators, so the agent's token must not belong to either.
Replay result: Stopped.
git reset --hard followed by git clean -fdx
Fix: Commit or stash before the agent starts, and push the branch to a remote. Git can bring back committed work, but not untracked or ignored files, so keep a copy of files such as .env that git does not track.
Replay result: Stopped.
rm -rf of the project .git folder
Fix: Push the repository to a remote often, so the history also exists outside the project folder. A mirror clone (git clone --mirror) or a backup of the folder works too.
Replay result: Stopped.