# Your GitHub account

Whoever controls your GitHub account controls what every user of your app installs next. Nothing in the repository can protect against a stolen login.

Source: https://ha-barkley.github.io/security/controls/account/

From HASC, the Home Assistant Security Controls for integrations, cards and apps. A community catalog, not an official Home Assistant or Open Home Foundation project.

Each control has an ID, cited as HASC-CI-4, and a level from 1 to 3. "Level marker" means anyone can check the control from outside the project, and levels are graded on those controls only.

> **From the 2026 sweep.** Of the 137 accounts that publish five or more apps, 72 (52.6%) have only ever had one account publish releases. If that one login is stolen, there's no second maintainer to notice or step in. The [Marketplace report](https://ha-barkley.github.io/marketplace/2026/accounts-and-reach/) has more on this.

## Controls

### ACC-1: Turn on two-factor login with a passkey or a security key

*Level 1*

**Why:** A common way to take over an account is a page that looks like a real login. A password and an authenticator code work on any site you type them into, and a lookalike can pass them straight on to the real one. A passkey or security key only works on the site it was made for. In 2025, phishing like this was used to publish malware from maintainers' accounts on both PyPI and npm ([how it happened](https://ha-barkley.github.io/security/attacks/#phishing)).

Settings → Password and authentication. An authenticator app is fine as a second method. Avoid SMS. Store the recovery codes somewhere offline.

### ACC-2: Replace classic personal access tokens with fine-grained ones

*Level 1*

**Why:** A token works for anyone who has a copy, with no password or 2FA, and copies end up in CI secrets, `.env` files and old laptops. A classic token can act on every repository you can reach and never expires. A fine-grained one only reaches the repository and permissions you gave it, until its expiry date. The Shai-Hulud worm collected tokens like these from developers' machines and CI in 2025 ([how it happened](https://ha-barkley.github.io/security/attacks/#shai-hulud)).

Settings → Developer settings → Personal access tokens. Give each token one repository, only the permissions it needs, and an expiry date. Delete tokens you no longer use.

### ACC-3: Review what can act for you

*Level 1*

**Why:** Every OAuth app, GitHub App, SSH key and signed-in session can act for you without your password, and each is another way into your account. Some were probably added years ago for something you no longer use. After the Shai-Hulud worm, CISA's advice included removing the GitHub Apps and OAuth apps you don't need ([how it happened](https://ha-barkley.github.io/security/attacks/#shai-hulud)).

Settings → Applications (OAuth apps and GitHub Apps), SSH keys, and Sessions. Remove anything you don't recognize or no longer use.

### ACC-4: Sign your commits

*Level 2 · Level marker*

**Why:** Git lets anyone put any name and email on a commit. A signature can't be made without your key, so signed commits let people tell your work from a commit pushed with a stolen token or written to look like yours. In 2021, two malicious commits were pushed to PHP's source code in the names of two of its core developers ([PHP's announcement](https://news-web.php.net/php.internals/113838)).

An SSH key is the simplest way. You can use the one you already push with.

1. If you don't have an SSH key, run `ssh-keygen -t ed25519`. It saves the public half as `~/.ssh/id_ed25519.pub`.
2. Tell Git to sign every commit and tag with it.
   
   `Terminal`
   
   ```
   git config --global gpg.format ssh
   git config --global user.signingkey ~/.ssh/id_ed25519.pub
   git config --global commit.gpgsign true
   git config --global tag.gpgsign true
   ```
   
   Change the path if your key has a different name.
3. Give GitHub the public key, so it can check your signatures. Until you do, your signed commits show "Unverified". In Settings → SSH and GPG keys, choose New SSH key, set Key type to *Signing Key*, and paste the line that `cat ~/.ssh/id_ed25519.pub` prints. Only share the file ending in `.pub`. The one without `.pub` is your private key. From a terminal, the GitHub CLI can do it instead:
   
   `Terminal`
   
   ```
   gh auth refresh -h github.com -s admin:ssh_signing_key
   gh ssh-key add ~/.ssh/id_ed25519.pub --type signing --title "My laptop"
   ```
   
   A key you already added for pushing has to be added again as a signing key.

Where the private key is kept decides what someone gets if they copy your files or run code on your machine:

| Where the key is                                    | Someone copies your files         | Malware runs as you               | Day to day                                                        |
|-----------------------------------------------------|-----------------------------------|-----------------------------------|-------------------------------------------------------------------|
| A file with no passphrase                           | They have your key                | Can sign                          | Nothing to type                                                   |
| A file with a passphrase, loaded into the SSH agent | Useless without the passphrase    | Can sign while the key is loaded  | Unlock once per login. macOS can keep the passphrase in Keychain. |
| A password manager's SSH agent                      | There's no key file               | Asks before each app uses the key | Approve each app                                                  |
| A security key (`ssh-keygen -t ed25519-sk`)         | The key never leaves the hardware | Needs a touch for every signature | A touch for every commit, so a rebase of 20 commits is 20 touches |

With a password manager, its own instructions give the value for `user.signingkey`. GPG keys work too, with GitHub's GPG instructions.

In a codespace you don't need a key of your own. Turn on Settings → Codespaces → GPG verification for the repositories you trust, and GitHub signs the commits you make there. Commits you make on GitHub's website are signed by GitHub already.

### ACC-5: Then turn on vigilant mode

*Level 2*

**Why:** Signing only helps if an unsigned commit in your name stands out. Without vigilant mode, GitHub shows an unsigned commit with no label, like most commits. With it on, an unsigned commit in your name shows "Unverified".

On the same page, tick "Flag unsigned commits as unverified". Any commit with your name that you didn't sign then shows "Unverified", including one pushed with a stolen token. Wait until a commit you push shows "Verified", or your own commits show "Unverified" too.

### ACC-6: Give the project a second maintainer, or at least a plan

*Level 2*

**Why:** When one person can publish, nobody notices an odd release from that account, and nobody can step in if that person loses access or moves on. If its maintainer leaves without a plan, a project can pass to whoever asks for it. In 2018, someone posing as a maintainer took over the event-stream package on npm and added code that stole from bitcoin wallets ([how it happened](https://ha-barkley.github.io/security/attacks/#event-stream)).

A free GitHub organization lets several people share a project and can require two-factor login for all of them. [Organizations](https://ha-barkley.github.io/security/controls/organizations/) covers when it's worth it. If you're on your own, write down in the README who can take over.

### Check it worked

Settings → Password and authentication lists a passkey or security key. Settings → Developer settings shows no classic tokens. Your recent commits show "Verified".

Barkley shows who has published an app's releases and flags a release from a new publisher. It can't see how an account is protected.
