Skip to content

MSC4287: Sharing key backup preference between clients #4287

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

andybalaam
Copy link
Member

@andybalaam andybalaam commented May 8, 2025

Rendered

I am employed by Element and a Matrix community member. This proposal was written and published with my Element client developer hat on.

@andybalaam andybalaam changed the title Sharing key backup preference between clients MSC4287: Sharing key backup preference between clients May 8, 2025
@andybalaam andybalaam marked this pull request as ready for review May 8, 2025 15:23
@turt2live turt2live added e2e proposal A matrix spec change proposal client-server Client-Server API kind:maintenance MSC which clarifies/updates existing spec needs-implementation This MSC does not have a qualifying implementation for the SCT to review. The MSC cannot enter FCP. labels May 12, 2025
Copy link
Member

Choose a reason for hiding this comment

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

Implementation requirements:

  • Client setting value
  • Client using value

Copy link
Member Author

Choose a reason for hiding this comment

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

element-hq/element-web#29912 implements this in Element Web.

## Security considerations

Unencrypted account data is under the control of the server, so a malicious
server could:
Copy link
Contributor

Choose a reason for hiding this comment

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

Something that could offset this a bit is strong requirements for clients to announce the setting to users. Either as a toast or dialog or something attention-grabby.

Copy link
Member Author

Choose a reason for hiding this comment

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

Noted in b7f2324

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm not sure whether clients should be required to bring this setting to users' attention on sign-in. Could be reasonable?

Comment on lines 42 to 44
* If this event type exists in account data and contains the specified property
in the correct format, clients MUST use it to determine whether key backups
are enabled for a user.
Copy link
Member

Choose a reason for hiding this comment

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

In the current impl, if there is a key backup on the server, and a matching private key is received (either from another client via secret gossiping or via recovery), do we actually check m.org.matrix.custom.backup_disabled? If so, what do we do if it is set to disabled:true? Do we delete the backup on the server?

Copy link
Member Author

Choose a reason for hiding this comment

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

We don't check it anywhere except sign-on in EW.

When a user signs in:

* If this event type exists in account data and contains the specified property
in the correct format, clients MUST use it to determine whether key backups
Copy link
Member

Choose a reason for hiding this comment

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

MUST feels a bit strong to me here, and throughout. I think SHOULD would be better?

Copy link
Member Author

Choose a reason for hiding this comment

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

Do you have an intuition for why? I'm thinking that if a client supports key backup but doesn't obey this flag it will really confuse other clients, so MUST seems appropriate, but I'm not sure of the conventions here.


* If this event type exists in account data and contains the specified property
in the correct format, clients MUST use it to determine whether key backups
are enabled for a user.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
are enabled for a user.
should be enabled.

Copy link
Member

Choose a reason for hiding this comment

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

When we say "backups are enabled": do we mean the process of backing up new keys, the process of downloading existing keys, or both?

I guess probably "both" but I think you could make a strong argument that downloading old keys could happen even if uploading new keys is disabled.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done in c6a6ffc

Copy link
Member Author

@andybalaam andybalaam May 19, 2025

Choose a reason for hiding this comment

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

When we say "backups are enabled": do we mean the process of backing up new keys, the process of downloading existing keys, or both?

I guess probably "both" but I think you could make a strong argument that downloading old keys could happen even if uploading new keys is disabled.

I was thinking of both, but your comment makes me think we should only ever opt out of uploading, and downloading should always be on? Maybe that's a wider discussion though.

Comment on lines +85 to +89
As specified, this only affects client behaviour when a user signs in. We could
specify that clients must watch the value of this account data and dynamically
change their key backup behaviour when it changes. This would increase the
severity of the security issues discussed below. Whether this behaviour would be
more or less surprising for the user is a potential discussion point.
Copy link
Member

Choose a reason for hiding this comment

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

It's worth noting that clients should already notice key backup being turned OFF, because attempts to upload new keys start failing. (EW has a NewRecoveryMethodDialog and a RecoveryMethodRemovedDialog, neither of which work very well, but they exist).

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed in 3d926bd except I talked about it being deleted, because I think that is what will cause us to notice, right?

undetermined and the client should either treat it as off, or make a choice and
update the value to reflect it.

### Behaviour on sign-in
Copy link
Member

Choose a reason for hiding this comment

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

Is it correct that we only check the flag on sign-in? Or do we check it at other times too?

Copy link
Member Author

Choose a reason for hiding this comment

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

That is correct in the current implementation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
client-server Client-Server API e2e kind:maintenance MSC which clarifies/updates existing spec needs-implementation This MSC does not have a qualifying implementation for the SCT to review. The MSC cannot enter FCP. proposal A matrix spec change proposal
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants