Skip to content

fix(crypto): sign-in never replaces a published key; qc keys publish (0.16.1, qc 0.12.0) - #342

Merged
ralyodio merged 1 commit into
masterfrom
fix/never-replace-published-key
Oct 27, 2026
Merged

ralyodio merged 1 commit into
masterfrom
fix/never-replace-published-key

Conversation

@ralyodio

Copy link
Copy Markdown
Contributor

Anthony (qc TUI): "[Encrypted message - decryption failed]".

Cause: on 2026-10-27 02:07 UTC a browser signed in as chovy with empty key
storage. postQuantumEncryption.initialize() generated a fresh keypair, and
keySyncService.autoSyncOnLogin saw "local key differs from database" and
published it over the account key (behaviour added in 11ced5a for rotation).
Every message sent after that was encrypted to a key only that one browser
holds, so qc and every other device failed. No reset happened (the key backup
from 10-06 is untouched, /api/keys/reset never called). qc 0.11.0 changed no
crypto code.

  • needsKeySync syncs only when the account has NO published key. A different
    key is reported (publishedKeyStatus 'differs', 'qrypt:key-mismatch' event),
    never replaced.
  • EncryptionWarning: "This device has different keys from your account" with
    Restore my keys (first) or a confirmed "Use this device's keys". "Generate new
    keys" now publishes explicitly (it relied on the sign-in sync).
  • qc keys [publish]: check whether this terminal holds the account key, and put
    it back (confirm or --yes). The TUI mismatch notice points at it.

Tests: 132 files / 871 tests green locally; next build + build-qc pass.

🤖 Generated with Claude Code

…(0.16.1, qc 0.12.0)

Anthony (qc TUI): "[Encrypted message - decryption failed]".

Cause: on 2026-10-27 02:07 UTC a browser signed in as chovy with empty key
storage. postQuantumEncryption.initialize() generated a fresh keypair, and
keySyncService.autoSyncOnLogin saw "local key differs from database" and
published it over the account key (behaviour added in 11ced5a for rotation).
Every message sent after that was encrypted to a key only that one browser
holds, so qc and every other device failed. No reset happened (the key backup
from 10-06 is untouched, /api/keys/reset never called). qc 0.11.0 changed no
crypto code.

- needsKeySync syncs only when the account has NO published key. A different
  key is reported (publishedKeyStatus 'differs', 'qrypt:key-mismatch' event),
  never replaced.
- EncryptionWarning: "This device has different keys from your account" with
  Restore my keys (first) or a confirmed "Use this device's keys". "Generate new
  keys" now publishes explicitly (it relied on the sign-in sync).
- qc keys [publish]: check whether this terminal holds the account key, and put
  it back (confirm or --yes). The TUI mismatch notice points at it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

ThreatCrush Security Scan

17 finding(s)

MEDIUM: 13 | LOW: 4

Severity Rule Location
MEDIUM js-unescaped-html-sink src/app/blog/[slug]/page.jsx:38
MEDIUM js-unescaped-html-sink src/app/blog/[slug]/page.jsx:66
MEDIUM js-unescaped-html-sink src/app/faq/page.jsx:57
MEDIUM js-unescaped-html-sink src/app/layout.jsx:142
MEDIUM js-unescaped-html-sink src/app/layout.jsx:146
MEDIUM js-unescaped-html-sink src/app/page.jsx:50
MEDIUM js-open-redirect src/app/phone/page.jsx:70
MEDIUM redos-nested-quantifier src/lib/auth/dns-name.js:88
MEDIUM redos-nested-quantifier src/lib/chat/voice-mode.js:116
MEDIUM redos-nested-quantifier src/lib/chat/voice-mode.js:121
MEDIUM js-unescaped-html-sink src/lib/components/chat/MessageItem.jsx:85
MEDIUM js-unescaped-html-sink src/lib/components/chat/MessageItem.jsx:130
MEDIUM js-unescaped-html-sink src/lib/components/PitFooter.jsx:15
LOW secret-generic-credential src/app/api/auth/register-anon/route.test.js:32
LOW secret-jwt tests/debug-sms.js:10
LOW secret-generic-credential tests/private-key-import-export.test.js:252
LOW secret-generic-credential tests/private-key-import-export.test.js:264

Snippets are redacted; ThreatCrush never prints matched credential material.

@ralyodio
ralyodio merged commit 3d4bbdc into master Oct 27, 2026
11 checks passed
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.

1 participant