Skip to content

fix(security): repair pre-existing CI baseline (passkey replay gate + hook tests) - #280

Open
cypriannwokolo2-creator wants to merge 2 commits into
masterfrom
fix/pre-existing-ci-failures
Open

fix(security): repair pre-existing CI baseline (passkey replay gate + hook tests)#280
cypriannwokolo2-creator wants to merge 2 commits into
masterfrom
fix/pre-existing-ci-failures

Conversation

@cypriannwokolo2-creator

Copy link
Copy Markdown
Contributor

Fixes #279

Security fixes (code, not assertions)

  • Replay gate was dead code: getAndVerifyTempChallenge() was never awaited in register/auth-verify — a pending Promise is truthy, so challenge/replay verification silently passed for ANY input. Now awaited. (This is why auth-verify returned 200 for never-stored challenges.)
  • Counter updates never persisted: route mutated the copy returned by getCredential(). Added updateCredentialCounter() (local map + best-effort backend PATCH).
  • PBKDF2 stays at 600k iterations (OWASP) — no security weakening anywhere.

Test repairs

  • Fixtures now store credentials with userId (route's ownership check is intentional and kept).
  • Unique per-request test IPs stop the shared rate-limit bucket from cascading 429s across tests.
  • Heavy key-derivation mocked at module boundary in route tests only.
  • Hooks: removed beforeEach(mockReset) (vitest v4 + hoisted factory issue); mockRejectedValue instead of setTimeout(reject).

Verified locally

  • passkey routes: 19/19 ✓ · hooks: 10/10 ✓ · lint ✓ · tsc ✓

…ze hook tests

- register/auth-verify: the temp-challenge replay gate was called without
  await, so a pending Promise was always truthy and verification was
  silently bypassed (replay risk). Now awaited on both routes.
- auth-verify: counter updates mutated a throwaway copy from getCredential();
  persist via new updateCredentialCounter() (local map + best-effort backend sync).
- routes.test.ts: fixtures store credentials with userId (ownership check is
  intentional); unique per-request IPs stop rate-limit cross-test cascade;
  heavy PBKDF2 (600k iters, OWASP) mocked at module boundary to keep tests fast.
- hook tests: drop beforeEach mockReset (breaks hoisted vi.mock factories in
  vitest v4); use mockRejectedValue instead of setTimeout(reject) which escaped act().

Fixes #279
@vercel

vercel Bot commented Aug 25, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
moistello-frontend Ready Ready Preview Aug 25, 2026 10:36am

…RL in SSR)

Relative-URL fetch at module import crashes Node's fetch whenever the
module is imported server-side (SSR/prerender/route handlers), spamming
WebServer logs and breaking E2E boots. The key is client-only by design;
server-side now skips the fetch and degrades exactly like a failed fetch did.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(ci): repair pre-existing test failures blocking the master baseline

1 participant