fix(matrix): fix E2EE SSSS bootstrap for passwordless token-auth bots#66228
Conversation
Greptile SummaryFixes two interrelated E2EE bootstrap bugs for passwordless token-auth Matrix bots: (1) adds Confidence Score: 5/5Safe to merge — fixes are narrowly scoped, pre-existing error handling is preserved, and test coverage directly validates both new behaviors. No P0/P1 issues found. The logic correctly gates repair on !status.signedByOwner, the catch block already covered UIA failures for password-bots, and extending it to passwordless bots is the intended semantic. No files require special attention. Reviews (1): Last reviewed commit: "test(matrix): add regression test for re..." | Re-trigger Greptile |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8b3fcc90b0
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
ead329a to
8e4b4a0
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8e4b4a019b
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
cc37e54 to
c62cebf
Compare
|
Merged via squash.
Thanks @SARAMALI15792! |
…openclaw#66228) Merged via squash. Prepared head SHA: c62cebf Co-authored-by: SARAMALI15792 <[email protected]> Co-authored-by: gumadeiras <[email protected]> Reviewed-by: @gumadeiras
…openclaw#66228) Merged via squash. Prepared head SHA: c62cebf Co-authored-by: SARAMALI15792 <[email protected]> Co-authored-by: gumadeiras <[email protected]> Reviewed-by: @gumadeiras
…openclaw#66228) Merged via squash. Prepared head SHA: c62cebf Co-authored-by: SARAMALI15792 <[email protected]> Co-authored-by: gumadeiras <[email protected]> Reviewed-by: @gumadeiras
…openclaw#66228) Merged via squash. Prepared head SHA: c62cebf Co-authored-by: SARAMALI15792 <[email protected]> Co-authored-by: gumadeiras <[email protected]> Reviewed-by: @gumadeiras
…openclaw#66228) Merged via squash. Prepared head SHA: c62cebf Co-authored-by: SARAMALI15792 <[email protected]> Co-authored-by: gumadeiras <[email protected]> Reviewed-by: @gumadeiras
…openclaw#66228) Merged via squash. Prepared head SHA: c62cebf Co-authored-by: SARAMALI15792 <[email protected]> Co-authored-by: gumadeiras <[email protected]> Reviewed-by: @gumadeiras
…openclaw#66228) Merged via squash. Prepared head SHA: c62cebf Co-authored-by: SARAMALI15792 <[email protected]> Co-authored-by: gumadeiras <[email protected]> Reviewed-by: @gumadeiras
…openclaw#66228) Merged via squash. Prepared head SHA: c62cebf Co-authored-by: SARAMALI15792 <[email protected]> Co-authored-by: gumadeiras <[email protected]> Reviewed-by: @gumadeiras
Summary
Fixes #66171
Passwordless token-auth Matrix bots fail to complete E2EE bootstrap when the homeserver has existing SSSS data but the bot has no local recovery key.
Problem Statement
Two independent bugs in
extensions/matrix/src/matrix/sdk.tscombine to permanently block E2EE bootstrap for passwordless token-auth bots connecting to a homeserver with existing (but inaccessible) SSSS:Bug 1:
MATRIX_INITIAL_CRYPTO_BOOTSTRAP_OPTIONS(line 140) is missingallowSecretStorageRecreateWithoutRecoveryKey: true. Without this flag, whenbootstrapCrossSigningencounters a nullgetSecretStorageKeyresponse (because the bot has no local recovery key),shouldRepairSecretStorageevaluates tofalse && true = false, so SSSS is never recreated. The explicit bootstrap path (bootstrapOwnDeviceVerification) already sets this flag correctly — the initial auto-startup path does not.Bug 2:
bootstrapCryptoIfNeededrepair path (line ~609) is gated behindthis.password?.trim(). Passwordless token-auth bots have no password, so even if Bug 1 were fixed, the repair bootstrap would never run. The intent of the gate was to ensure a UIA credential was available — but UIA failures are already caught and logged gracefully in the existing try/catch, so the gate is overly conservative.Solution Approach Applied
Two minimal edits to
extensions/matrix/src/matrix/sdk.ts:Edit 1 — Add flag to initial bootstrap options (~line 140):
Edit 2 — Remove password gate in repair path (~line 609):
Replace
else if (this.password?.trim()) { ... } else { LogService.warn(...) }with a plainelse { ... }— the try/catch body stays identical, only the gate is removed. Added comment explaining passwordless repair intent to prevent regression.Test updates in
extensions/matrix/src/matrix/sdk.test.ts:Bottleneck Solved
Before: Fresh bot / bot with wiped data directory connecting to homeserver that has existing SSSS →
getSecretStorageKeyreturns null → error silently swallowed → no repair attempted → bot stays unverified forever.After: Same scenario →
getSecretStorageKeyreturns null → repair bootstrap runs → SSSS recreated with new keys → bot becomes verified.Expected Outcomes
Current Flow
MATRIX_INITIAL_CRYPTO_BOOTSTRAP_OPTIONS(now includesallowSecretStorageRecreateWithoutRecoveryKey: true)getSecretStorageKeyreturns null,bootstrapCrossSigningrecreates SSSSMATRIX_AUTOMATIC_REPAIR_BOOTSTRAP_OPTIONSVerification
pnpm buildpasses (TypeScript compilation confirms types are correct).Full test suite not run in this PR (monorepo tests take 10+ min). CI will verify.