Skip to content

fix(core): log why a passkey sign-in was rejected - #4750

Open
danielmlr wants to merge 1 commit into
mainfrom
daniel/log-passkey-signin-rejection
Open

danielmlr wants to merge 1 commit into
mainfrom
daniel/log-passkey-signin-rejection

Conversation

@danielmlr

Copy link
Copy Markdown
Contributor

What does this PR do?

Adds the reason to the server logs when a passkey sign-in is rejected. Until now the verify route turned each PasskeyAuthenticationError into the same 401 and logged nothing, so nobody could tell an unknown passkey from a wrong site address or an expired challenge, not even in the Workers logs. In #4645 a passkey sign-in started failing after an update, and the cause is still unknown.

The route now logs [passkey] sign-in rejected: <code>. Some error messages include values from the request, so only the code is logged. The response is unchanged. The authentication guide explains the log line.

The passkey registration routes already log why a passkey was rejected.

#4189 went further and explained an unknown passkey on the login page. It was closed as a stale draft, and this change doesn't get in its way.

Related to #4645

Type of change

  • Bug fix
  • Feature (requires an accepted feature plan or RFC)
  • Refactor (no behavior change)
  • Translation
  • Documentation
  • Performance improvement
  • Tests
  • Chore (dependencies, CI, tooling)

Your connection to this change

  • I use EmDash and ran into the problem this PR addresses
  • I maintain a tool, dependency, or service that EmDash uses, and this change concerns that integration
  • A Maintainer approved this specific change before I opened the PR

I'm a Maintainer, and I chose this change while triaging #4645.

Checklist

  • I have read CONTRIBUTING.md
  • pnpm typecheck passes
  • pnpm lint passes
  • pnpm test passes (or targeted tests for my change)
  • pnpm format has been run
  • I have added/updated tests for my changes (if applicable)
  • User-visible strings in the admin UI are wrapped for translation (if applicable). Do not include messages.po changes except in translation PRs — a workflow extracts catalogs on merge to main. (n/a: no admin UI change)
  • I have added and reviewed the user-facing changeset (if this PR changes a published package)
  • New features link to their merged design PR: https://github.com/emdash-cms/emdash/pull/... (n/a: bug fix)
  • I have included screenshots below if this PR changes the UI (n/a: no UI change)

AI assistance disclosure

  • This PR includes AI-generated code or text — model/tool: Claude Code (Claude Opus 5.5)

Screenshots / test output

Not applicable, no UI change.

New cases in passkey-verify-route.test.ts send an unknown passkey and a passkey from another origin. They check the logged code and the unchanged 401, and both failed before the change. They replace the older unknown-passkey case. On demos/simple, posting an unknown passkey to the verify route returns the same 401 body and logs [passkey] sign-in rejected: credential_not_found.

The passkey verify route turned every PasskeyAuthenticationError into the
same 401 "Authentication failed" and logged nothing, so a site owner
could not tell an unknown passkey from an origin mismatch or an expired
challenge, not even in the server logs.

Log the error code with console.warn. The code comes from a closed
union, while some error messages embed values from the request, so only
the code is logged. The response stays the same.

The authentication guide's troubleshooting entry now points to the log
line and the codes a site owner can act on.
@changeset-bot

changeset-bot Bot commented Nov 7, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: b1a26ba

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 12 packages
Name Type
emdash Patch
@emdash-cms/cloudflare Patch
@emdash-cms/plugin-test Patch
@emdash-cms/sandbox-workerd Patch
@emdash-cms/admin Patch
@emdash-cms/auth Patch
@emdash-cms/blocks Patch
create-emdash Patch
@emdash-cms/gutenberg-to-portable-text Patch
@emdash-cms/x402 Patch
@emdash-cms/auth-atproto Patch
@emdash-cms/plugin-embeds Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@emdashbot emdashbot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The approach is sound and narrowly scoped. Every PasskeyAuthenticationError previously produced the same 401 with no log, so operators could not diagnose #4645. A single console.warn with the error code fixes that, leaves the 401 response unchanged, and avoids logging request-derived messages such as the client origin. Both reviewers approved and found nothing to fix. They checked that the documented error codes exist, the doc anchors resolve, and the changeset is an appropriate patch bump. They also found that the tests use real credentials and challenges and assert both the logged code and the unchanged 401. The review was static, so tests and builds were not run. The change does not claim to fix the underlying sign-in failure.


Reviewed by anthropic/claude-opus-5-5 and openai/gpt-6.1-sol.

@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
✅ Deployment successful!
View logs
docs b1a26ba Nov 07 2026, 08:50 PM

@cloudflare-workers-and-pages

Copy link
Copy Markdown

🚀 Deploying Preview to Cloudflare 🚀

Preview URL: https://daniel-log-passkey-signin-rejection.try.emdashcms.com, https://daniel-log-passkey-signin-rejection-emdash-playground.emdash-cms.workers.dev (commit b1a26ba)

This URL reflects your latest Preview deployment

Preview Deployments by commit

Status Deployment URL Commit Updated (UTC) See this deployment's details
  • Build: Success ✅
  • Deployment: Success ✅

View logs ↗
https://72332af9.try.emdashcms.com, https://72332af9-emdash-playground.emdash-cms.workers.dev b1a26ba 2026-11-07T20:50:49.070Z Visit the dashboard ↗

@pkg-pr-new

pkg-pr-new Bot commented Nov 7, 2026

Copy link
Copy Markdown

Open in StackBlitz

@emdash-cms/admin

npm i https://pkg.pr.new/@emdash-cms/admin@4750

@emdash-cms/auth

npm i https://pkg.pr.new/@emdash-cms/auth@4750

@emdash-cms/auth-atproto

npm i https://pkg.pr.new/@emdash-cms/auth-atproto@4750

@emdash-cms/blocks

npm i https://pkg.pr.new/@emdash-cms/blocks@4750

@emdash-cms/cloudflare

npm i https://pkg.pr.new/@emdash-cms/cloudflare@4750

@emdash-cms/contentful-to-portable-text

npm i https://pkg.pr.new/@emdash-cms/contentful-to-portable-text@4750

emdash

npm i https://pkg.pr.new/emdash@4750

create-emdash

npm i https://pkg.pr.new/create-emdash@4750

@emdash-cms/gutenberg-to-portable-text

npm i https://pkg.pr.new/@emdash-cms/gutenberg-to-portable-text@4750

@emdash-cms/plugin-cli

npm i https://pkg.pr.new/@emdash-cms/plugin-cli@4750

@emdash-cms/plugin-test

npm i https://pkg.pr.new/@emdash-cms/plugin-test@4750

@emdash-cms/plugin-types

npm i https://pkg.pr.new/@emdash-cms/plugin-types@4750

@emdash-cms/registry-client

npm i https://pkg.pr.new/@emdash-cms/registry-client@4750

@emdash-cms/registry-lexicons

npm i https://pkg.pr.new/@emdash-cms/registry-lexicons@4750

@emdash-cms/registry-loader

npm i https://pkg.pr.new/@emdash-cms/registry-loader@4750

@emdash-cms/registry-moderation

npm i https://pkg.pr.new/@emdash-cms/registry-moderation@4750

@emdash-cms/registry-verification

npm i https://pkg.pr.new/@emdash-cms/registry-verification@4750

upgrade-emdash

npm i https://pkg.pr.new/upgrade-emdash@4750

@emdash-cms/sandbox-workerd

npm i https://pkg.pr.new/@emdash-cms/sandbox-workerd@4750

@emdash-cms/x402

npm i https://pkg.pr.new/@emdash-cms/x402@4750

@emdash-cms/plugin-ai-moderation

npm i https://pkg.pr.new/@emdash-cms/plugin-ai-moderation@4750

@emdash-cms/plugin-ai-search

npm i https://pkg.pr.new/@emdash-cms/plugin-ai-search@4750

@emdash-cms/plugin-atproto

npm i https://pkg.pr.new/@emdash-cms/plugin-atproto@4750

@emdash-cms/plugin-audit-log

npm i https://pkg.pr.new/@emdash-cms/plugin-audit-log@4750

@emdash-cms/plugin-color

npm i https://pkg.pr.new/@emdash-cms/plugin-color@4750

@emdash-cms/plugin-embeds

npm i https://pkg.pr.new/@emdash-cms/plugin-embeds@4750

@emdash-cms/plugin-field-kit

npm i https://pkg.pr.new/@emdash-cms/plugin-field-kit@4750

@emdash-cms/plugin-forms

npm i https://pkg.pr.new/@emdash-cms/plugin-forms@4750

@emdash-cms/plugin-webhook-notifier

npm i https://pkg.pr.new/@emdash-cms/plugin-webhook-notifier@4750

commit: b1a26ba

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant