Repository navigation
Conversation
…ay to verify Add the `matrix_authentication_service.skip_cross_signing_reset_approval_without_verification_methods` option, off by default. When it is on, replacing the master cross-signing key does not require approval in MAS if the user has no way to verify their device: none of their devices is signed by their current self-signing key, and their current identity is not and has not been in secret storage (recovery). Clients wipe secret storage before uploading the new keys, so checking it at upload time is not enough. Instead, whenever `m.secret_storage.default_key` or `m.cross_signing.master` is changed while the master key is in secret storage, the current master key is marked with the new `was_in_recovery` column. A new identity starts without the mark. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: mxandreas <andreass@element.io>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: mxandreas <andreass@element.io>
Schema DiffPlease check that this looks as expected! common (sqlite)Unchanged common (postgres)Unchanged main (sqlite)--- /tmp/schema_diff_wffl_jy1/before/main/full_schemas/9999/full.sql.sqlite 2026-11-21 20:10:23.889975362 +0000
+++ /tmp/schema_diff_wffl_jy1/after/main/full_schemas/9999/full.sql.sqlite 2026-11-21 20:10:09.673961484 +0000
@@ -196,21 +196,21 @@
);
CREATE INDEX room_retention_max_lifetime_idx on room_retention(max_lifetime);
CREATE TABLE e2e_cross_signing_keys (
user_id TEXT NOT NULL,
-- the type of cross-signing key (master, user_signing, or self_signing)
keytype TEXT NOT NULL,
-- the full key information, as a json-encoded dict
keydata TEXT NOT NULL,
-- for keeping the keys in order, so that we can fetch the latest one
stream_id BIGINT NOT NULL
-, updatable_without_uia_before_ms bigint DEFAULT NULL, instance_name TEXT);
+, updatable_without_uia_before_ms bigint DEFAULT NULL, instance_name TEXT, was_in_recovery BOOLEAN NOT NULL DEFAULT FALSE);
CREATE UNIQUE INDEX e2e_cross_signing_keys_idx ON e2e_cross_signing_keys(user_id, keytype, stream_id);
CREATE TABLE e2e_cross_signing_signatures (
-- user who did the signing
user_id TEXT NOT NULL,
-- key used to sign
key_id TEXT NOT NULL,
-- user who was signed
target_user_id TEXT NOT NULL,
-- device/key that was signed
target_device_id TEXT NOT NULL,
main (postgres)--- /tmp/schema_diff_wffl_jy1/before/main/full_schemas/9999/full.sql.postgres 2026-11-21 20:10:24.632976070 +0000
+++ /tmp/schema_diff_wffl_jy1/after/main/full_schemas/9999/full.sql.postgres 2026-11-21 20:10:10.408962525 +0000
@@ -342,21 +342,22 @@
ip text,
user_agent text,
hidden boolean DEFAULT false
);
CREATE TABLE e2e_cross_signing_keys (
user_id text NOT NULL,
keytype text NOT NULL,
keydata text NOT NULL,
stream_id bigint NOT NULL,
updatable_without_uia_before_ms bigint,
- instance_name text
+ instance_name text,
+ was_in_recovery boolean DEFAULT false NOT NULL
);
CREATE SEQUENCE e2e_cross_signing_keys_sequence
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
CREATE TABLE e2e_cross_signing_signatures (
user_id text NOT NULL,
key_id text NOT NULL,
state (sqlite)Unchanged state (postgres)Unchanged |
| if not master_key_updatable_without_uia: | ||
| if ( | ||
| not master_key_updatable_without_uia | ||
| and not await self._can_reset_without_approval(user_id) |
There was a problem hiding this comment.
does this logic need to be specific to MAS? shouldn't it apply equally to the UIA case?
There was a problem hiding this comment.
I think it does not have to be. My main argument was to change as little as possible and the main friction point is currently MAS (duplicate warnings with conflicting severity) whereas non-MAS cases you need to enter account password which is at least not misleading. But indeed from security/consistency perspective it makes sense to change both, MAS and non-MAS.
| this natively, but a reverse proxy between Synapse and MAS may not. | ||
| default: false | ||
|
|
||
| skip_cross_signing_reset_approval_without_verification_methods: |
There was a problem hiding this comment.
I'm not entirely convinced this should be configurable. If we've decided that this logic makes sense, why do we need to support a config option which people will have to go and turn on, and we'll have to remember that Synapse behaves differently depending on how its configured (and ideally we'll have to test that our clients work correctly against both configurations)?
There was a problem hiding this comment.
Yes, fine to keep it simple. I was thinking of this more as a rollout feature flag but if we can do without it, it is certainly less complexity now and in the future.
Part of element-hq/element-meta#3372.
When a user resets their cross-signing identity on a homeserver using MAS, Synapse sends them to MAS to approve the reset. If the user has no way to verify their device anyway, that step only adds friction. This adds an option to skip it in that case:
It is off by default and only applies with MAS.
A user has a way to verify if any of these is true:
m.cross_signing.masteris encrypted with the key named inm.secret_storage.default_key.was_in_recoverycolumn. A new master key starts without the mark. This also stops someone with a stolen access token from blanking the account data to skip approval.Turning recovery off deliberately therefore also keeps approval required for that identity, as today.
Tested locally with MAS, Element Web and Element X: no way to verify → reset completes without MAS; another verified device or recovery set up → MAS approval is still required.
Pull Request Checklist
EventStoretoEventWorkerStore.".code blocks.🤖 Generated with Claude Code (Claude Opus 5.5)