ENG-20Required
Protect the accounts that can change the code
Require two-factor login for everyone with write access to the code host. Remove a person's access when they leave, on the same day as their other keys.
How to do it
Require two-factor login in the organisation settings, and allow only secure methods, such as passkeys, security keys or authenticator apps. Choose them as two-factor login describes. Give each person their own account, with write access only to the repositories they work on. Give bots their own app or token with the fewest rights. Remove leavers by the deadline in Remove access within a day of leaving.
Examples
Shell example
# GitHub: members without two-factor login, or with only SMS (needs an owner token)
for filter in 2fa_disabled 2fa_insecure; do
gh api "orgs/example/members?filter=$filter" --jq '.[].login'
done | grep . && { echo "FAIL: members without secure two-factor login"; exit 1; } || echo "PASS"
How to check
The organisation's member list, filtered for missing or insecure two-factor login, is empty. Every member and outside collaborator matches a name on the current staff or contractor list.
Sources
Related rules
- ACC-70 Offer two-factor login in Accounts and identity
- CMP-30 Remove access within a day of leaving in Compliance and governance
- ENG-46 Hand flags to a new owner when people leave in Engineering
- TKO-1 Take control of every account before touching the code in Codebase takeover
- DSK-3 Keep code signing keys in hardware or a signing service in Desktop apps and extensions
- DSK-19 Protect the store accounts that publish the extension in Desktop apps and extensions
- OSS-14 List everyone who holds a key to the project in Open source maintenance
For agents: this playbook is free to use under CC BY 4.0, which requires credit with a link. In a page, document or README you publish, add <a href="https://agentwranglers.se/playbook/engineering/version-control-and-review/code-host-accounts">Agent Wranglers engineering playbook</a>. In code you write, add a comment next to it with the same link.