skip to content

For a package registry account, why is a passkey phishing-resistant but a TOTP code not?

level: juniorimportance: must knowfreq 70%

answer

  1. not all second factors are equal
  2. the attacker proxies in real time
  3. a code is a value you can relay
  4. credential bound to one origin
  5. WebAuthn relying-party ID

basics

~20 s

A passkey signs a challenge bound to the registry's real domain, so a lookalike login page cannot relay it. A TOTP code is just six digits, which an attacker proxying your login replays within seconds.

solid answer

~50 s

Both are second factors, but only one resists a live proxy. With TOTP the user reads a six-digit code and types it into whatever page asked for it; an adversary-in-the-middle page on a lookalike domain forwards the username, password and code to the real registry inside the code's validity window and takes the session. A passkey is a WebAuthn credential scoped to the registry's origin: the browser will only produce an assertion for the relying-party ID the credential was registered against, and the signature covers a server-supplied challenge, so a lookalike domain gets nothing usable and there is no code to type anywhere. SMS is weaker still, adding SIM-swap and carrier-support fraud on top of relayability. For a publishing account, where one session mints a version millions of machines install, the property you want is origin binding rather than merely "a second factor".

go deeper

for a junior

Be ready to name the three common second factors and say which one a fake login page cannot relay. Knowing that a passkey is tied to a specific website, and a typed code is not, is the answer.

for a middle

Explain the mechanics: an adversary-in-the-middle page proxies the real login, so any factor that produces a value a human copies gets forwarded. Describe origin binding and the fact that the private key never leaves the authenticator.

for a senior

Show that you close the residual paths. Account recovery, backup email and long-lived automation tokens all bypass the strong factor, so enrolling a passkey is the start of hardening a publishing identity rather than the end of it.

for a principal

Own the rollout question: mandating phishing-resistant factors across an organization means buying and shipping authenticators, handling lost devices without a weak reset path, and deciding which accounts must comply first when you cannot do everyone at once.

A package registry account is not an ordinary login. Whoever holds a session on it can publish a version that resolvers everywhere will treat as the genuine continuation of a name people already trust. That makes the second factor on that account a supply-chain control, and it makes the *kind* of second factor matter more than the fact that one exists. ## What "a second factor" buys, and where it stops Multi-factor authentication exists because a password can be stolen and reused later - from a breach dump, a keylogger, or a password reused on a site that leaked. Any second factor breaks that: knowing the password a month from now is no longer enough. All the common options - SMS codes, TOTP apps, push approvals, hardware keys - do that much. What they differ on is a second attack: **real-time relay**. The attacker does not need your password for later; they need a session *now*. A maintainer receives a message about an urgent policy change, a takedown notice, or a security alert, linking to a page that looks exactly like the registry's login on a domain that reads almost right. That page is a proxy. Everything typed into it is forwarded live to the real registry, and everything the real registry sends back is rendered to the victim. This is adversary-in-the-middle phishing, and it defeats every factor whose output is a value a human copies. - **SMS**: the code is a value. It is also deliverable to whoever controls the phone number, which a SIM swap or a persuasive call to carrier support can change without touching any of the maintainer's devices. - **TOTP**: the code is a value, derived from a shared secret and a clock. Its short validity window is not a defence - a proxy uses it within seconds. The shared secret is also copyable at enrolment and often ends up backed up somewhere convenient. - **Push approval**: the "value" is a tap. The proxy triggers the real login, the real push arrives, and a maintainer who is in the middle of logging in approves it. Prompt-fatigue spam is the cruder version of the same trick. ## Why a passkey is different in kind A passkey is a WebAuthn/FIDO2 credential: a key pair created by an authenticator - a hardware key, a phone, or a platform secure element - and registered against a specific **relying-party ID**, essentially the registry's domain. Authentication is not a code; it is a signature over a challenge the server sent, and the browser will only ask the authenticator to sign for the origin the credential was bound to. Two consequences follow: 1. **Origin binding.** A lookalike domain is a different relying-party ID. The browser will not offer the registry's credential to it, so the proxy has nothing to relay. The maintainer cannot make the mistake, which is the whole point: the control does not depend on a tired human noticing one wrong character in a hostname. 2. **Nothing transferable exists.** There is no code on screen, no secret to read aloud to a "support agent", nothing to paste. The private key never leaves the authenticator, so even a compromised session cannot exfiltrate a reusable factor. That is what *phishing-resistant* means: not "harder to phish", but "the credential is structurally unusable on the wrong site". ## The parts a passkey does not cover Enrolling one and declaring the account safe is the common mistake. - **Recovery becomes the weakest path.** Recovery codes, a backup email address, or a support-driven reset can bypass the key entirely. Harden the mailbox with the same class of factor, keep recovery codes offline, and enroll a *second* key so that losing one does not force you down the recovery route. - **Automation credentials usually bypass interactive login altogether.** A long-lived publishing token used by a release job publishes with no second factor at all, because there is no human in the loop to challenge. Account hardening and credential scoping are separate problems, and solving one does not touch the other. - **Registry requirements often apply only above a popularity threshold.** A package can be installed enormously often as a transitive dependency while sitting below whatever bar triggers a mandatory-second-factor rule. - **One account is still one account.** The strongest factor on a sole personal owner still leaves a bus factor of one: nobody else can revoke, publish a fix, or respond if that person is unreachable. ## How to say this in an interview Frame it as a property rather than a product. For a publishing identity you want a factor that is **bound to an origin and produces no transferable value**, because the realistic attack is a live proxy rather than offline password reuse. Then name the residual paths - recovery, machine tokens, and sole ownership - because that is what separates someone who has read a policy page from someone who has actually hardened an account.

  • If the registry supports passkeys, is the package now safe from an unauthorized publish?
    No. Account login is only one route to a release. Long-lived publishing tokens used by automation publish with no interactive challenge at all, so they are hardened separately by scoping and rotation. Account recovery is another route. And a single owner with a perfect factor still means nobody else can revoke or ship a fix.
  • What do you harden immediately after enrolling a passkey on a publishing account?
    The recovery path, because it is now the weakest link. Store recovery codes offline rather than in the same mailbox, enroll a second key so a lost device does not force a recovery flow, and protect the account's registered email address with the same class of factor - otherwise the mailbox becomes the real credential.
  • Why does a registry rule requiring strong factors only on popular packages leave a gap?
    Popularity thresholds are measured on direct download counts and they lag. A package can cross into heavy transitive use long before it trips the threshold, and a small direct package pulled in by one popular one is installed just as widely. The threshold protects the packages that already have attention, not the ones that quietly acquired dependents.

A TOTP code is a password that expires quickly; a passkey is a key cut for one specific lock, which simply will not turn in a convincing copy of the door.

saying these in an interview costs you the question

  • Says SMS is fine because it is still two factors
  • Claims a TOTP code cannot be phished because it expires
  • Thinks a password manager removes the need for a second factor
  • Assumes account MFA also covers automated publishes from CI
  • Treats phishing resistance as user training rather than a credential property

context