Hardware security keys for developers and AI engineers
By Flavio
Tagged: Security
How physical security keys like YubiKeys protect your GitHub, email, password manager, and AI workflows from phishing and breaches without slowing you down.
On November 19, 2026, 1Password began investigating unauthorized access to an employee’s corporate GitHub account. By the time 1Password disclosed the incident on November 25 (and summarized it on X), the attacker had copied private repositories, reached CI/CD, and pushed code to backend services that exported customer names, email addresses, account IDs, SRP parameters, and some pending invite and recovery tokens.
Customer vaults stayed untouched because 1Password does not store master passwords or Secret Keys on its servers. Still, a breach like that immediately creates two worries for anyone building software: targeted phishing emails built from the leaked customer list, and the question of how much damage a single compromised GitHub account or password manager can cause.
I have not moved my own accounts to hardware security keys yet, so this incident pushed me to map out how physical keys like YubiKeys work, what they protect against, and whether they slow down a developer or AI engineer’s daily workflow.
A physical key on your desk cannot stop a vendor from leaking metadata stored on its own backend. It protects you from what happens next: convincing phishing pages built from that leaked data, a future worst-case compromise of your password manager, and the exact kind of GitHub account takeover that started this breach.
How a hardware security key works
A hardware security key (such as a YubiKey) is a small USB-C device, usually with NFC for phones, holding a cryptographic chip. Private keys are generated inside that chip and can never be read out or copied.
When you sign in to a site that supports FIDO2 / WebAuthn, you enter your password or trigger a passkey, plug the key into your Mac (or tap it on your phone), and touch the metal contact. The site sends a fresh challenge, the key signs it, and the server checks the signature with your public key. I cover the underlying protocol in Passkeys and WebAuthn explained.
The reason hardware keys beat 6-digit authenticator codes and SMS is domain binding. Your browser passes the exact hostname you are visiting to the key before it signs.
If a phishing email mimics a 1Password recovery prompt and sends you to a lookalike domain, a 6-digit code gets relayed to the real site within seconds. A hardware key refuses to respond because the hostname does not match, and a remote attacker cannot physically touch the key on your desk.
| Method | Resists real-time phishing | Resists SIM swap | Survives password-manager breach | Daily friction |
|---|---|---|---|---|
| Password only | No | N/A | No | Very low |
| SMS 2FA | No | No | Yes (unless phone is hijacked) | Medium (wait for text) |
| Authenticator app (TOTP) | No | Yes | Only if stored outside the password manager | Medium (open phone, type 6 digits) |
| Hardware security key (FIDO2) | Yes | Yes | Yes | Low (plug in or tap once per new session) |
Two layers for developers and AI engineers
Most security advice treats every account the same. When you write software and run coding agents every day, your setup has two very different surfaces.
The first is your human control plane: the accounts that can reset passwords, change DNS, transfer domains, push releases, rotate API keys, or edit billing. That means your primary email, GitHub, your password manager, Cloudflare or your domain registrar, Apple or Google, and Stripe.
The second is your unattended dev and agent plane: local terminal commands, git push, build scripts, and coding agents calling APIs while you work on something else.
Putting hardware keys on the human control plane locks down the highest-impact accounts without getting in the way of your terminal or your agents. Coding agents still need their own boundaries, because an agent has no finger to tap a key anyway. I cover those patterns in How AI agents can log in without seeing your passwords and How to protect secrets when coding agents deploy your app.
What hardware keys stop, and what they miss
Hardware keys solve credential theft and phishing. They are not a firewall for everything on your machine, so it helps to be clear about the boundary.
| Threat | Stopped by a hardware key? | What handles it instead |
|---|---|---|
| Targeted phishing email after a breach | Yes | Hardware key domain binding blocks the fake site |
| Leaked password plus 1Password Secret Key | Yes | Key is required to authorize a new device |
| Remote GitHub login takeover | Yes | Hardware key 2FA with SMS fallback disabled |
| SIM swap attack | Yes | Hardware key replaces phone-number 2FA |
| Infostealer reading browser session cookies | No | Endpoint hygiene and shorter session lifetimes |
Exposed .env file or long-lived GitHub PAT | No | Fine-grained expiring tokens, 1Password Environments, and provider revocation |
| Prompt injection in a coding agent | No | Agent sandboxing, read-only defaults, and scoped credentials |
| Vendor backend leaking customer metadata | No | Minimize stored data and treat follow-up emails as suspicious |
If a hosted AI tool or script leaks a model provider key or a GitHub Personal Access Token, a YubiKey will not stop someone from calling the API with that token. You still have to revoke the credential at the provider, as outlined in What to do when an AI tool exposes your provider keys.
Picking the right keys (and why you buy two)
Rule one with physical keys is simple: buy at least two, never one.
If you only register a single key and you lose it, break it, or wash it in your pocket, recovering locked-down accounts gets painful fast. Keep one key on your desk or keychain for daily use, and store the second key in a drawer or safe at home. Whenever you enroll a site, register both keys in the same sitting.
For a modern Mac and iPhone setup, USB-C plus NFC covers both laptop and phone without adapters. Here is how Yubico’s three main USB-C models compare at current US list prices:
| Model | US price | Connector | NFC | FIDO2 / Passkeys | OATH-TOTP, OpenPGP, PIV | Best fit |
|---|---|---|---|---|---|---|
| Security Key C NFC | $29 | USB-C | Yes | Yes | No | Pure web 2FA and passkeys on a budget |
| YubiKey 5C NFC | $58 | USB-C | Yes | Yes | Yes | Developers who want TOTP, SSH, or GPG on the key |
| YubiKey 5C Nano | $68 | USB-C (flush) | No | Yes | Yes | Stays plugged into a Mac permanently |
Two Security Key C NFC keys ($58 total) already cover phishing-resistant 2FA on 1Password, GitHub, email, Cloudflare, and Apple. Step up to the 5C series if you also want to move 6-digit TOTP codes off your phone and password manager onto the key itself, or if you want a flush Nano key that lives permanently in a Mac port paired with a 5C NFC on your keychain.
What changes in your daily workflow
The main reason developers avoid hardware keys is the fear of plugging in a dongle ten times a day. In practice, you touch the key a few times a month.
Your 1Password daily unlock stays unchanged. On macOS you still unlock the app with Touch ID or your password. 1Password only asks for the hardware key when you sign in on a brand-new device or on my.1password.com.
Your browser sessions on GitHub, Cloudflare, email, and Stripe stay logged in for weeks. You tap the key when a session expires or when GitHub opens a sudo confirmation prompt for repo settings, SSH keys, or billing. That takes about three seconds, which is faster than unlocking your phone and typing a rotating 6-digit code.
Your terminal, git push, CLIs, and coding agents stay untouched unless you deliberately move SSH keys onto the YubiKey.
There are four practical annoyances worth knowing upfront:
- Initial setup takes half an hour. Enrolling both keys across your core accounts and saving offline recovery codes is a one-time chore.
- Weak fallbacks defeat the key. After registering your keys on a site, disable SMS 2FA wherever the site allows it. Otherwise an attacker clicks “try another way” and bypasses the hardware key.
- YubiKey 5 accidental touches. Out of the box, brushing the metal contact on a plugged-in YubiKey 5 types a 44-character Yubico OTP string into whatever text field has focus. Disable Yubico OTP in the Yubico Authenticator app right after unboxing (the cheaper Security Key C NFC does not have this behavior).
- Apple Account has no recovery safety net. Turning on Hardware Security Keys for an Apple Account requires two keys and disables standard Apple account recovery. If you lose both keys and every trusted Apple device at the same time, Apple will not unlock the account. Services like 1Password, GitHub, and Cloudflare still let you store printed recovery codes offline.
Also think about breaking the single point of failure in your password manager. Storing both your passwords and your 6-digit TOTP codes inside 1Password is convenient, because autofill handles both. Moving your top accounts onto hardware keys (and keeping any remaining critical TOTP codes in a separate app or on a YubiKey 5) means a compromised vault alone still cannot log in.
The macOS gotcha for hardware-backed SSH keys
OpenSSH supports FIDO hardware-backed SSH keys (ed25519-sk), where every SSH connection requires a physical tap on your key. If you use SSH heavily (see SSH for developers), you might be tempted to try it right away on macOS.
Checking the built-in macOS ssh binary makes it look ready out of the box:
/usr/bin/ssh -V
/usr/bin/ssh -Q key | grep sk
On macOS, that returns:
OpenSSH_9.9p2, LibreSSL 3.3.6
[email protected]
[email protected]
[email protected]
[email protected]
When you actually try to enroll a key with Apple’s bundled ssh-keygen, it fails immediately:
ssh-keygen -t ed25519-sk -f /tmp/test-sk-check -N ""
Generating public/private ed25519-sk key pair.
You may need to touch your authenticator to authorize key generation.
No FIDO SecurityKeyProvider specified
Key enrollment failed: invalid format
Apple builds its system OpenSSH without internal libfido2 middleware. If you want ed25519-sk keys on a Mac, install Homebrew’s OpenSSH first and make sure /opt/homebrew/bin comes before /usr/bin in your PATH:
brew install openssh
Even with Homebrew OpenSSH installed, keep hardware-backed SSH keys for production servers where you want a human tap before a shell opens. Do not put a physical-tap requirement on repos where local scripts or coding agents need to push commits unattended.
How I would roll this out
If I were setting this up from scratch this weekend, I would keep the scope tight so the habit sticks:
- Order two USB-C + NFC keys. Two Security Key C NFC keys if I only care about web logins, or a YubiKey 5C Nano for my Mac plus a 5C NFC for my keychain and phone.
- Lock down five accounts first. Primary email, 1Password, GitHub, Cloudflare (and any domain registrar), and Stripe. Register both keys on each one and print the recovery codes onto paper stored with the backup key.
- Turn off SMS 2FA on those five accounts and stop keeping their 2FA codes inside the same password manager that holds their passwords.
- Leave daily CLI and agent workflows alone for the first month. Once web logins feel effortless, decide later whether production VPS SSH access or Git commit signing is worth adding on top.
For the broader security foundations behind all of this, from password hashing and session cookies to supply-chain hygiene, see my free Web & API Security Handbook.
Want me to talk about your product? You can sponsor this site.
Related posts about security: