Skip to content
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

fix(recovery): Delete the known secrets from 4s when disabling recovery #4629

Merged
merged 1 commit into from
Feb 11, 2025

Conversation

poljar
Copy link
Contributor

@poljar poljar commented Feb 5, 2025

  • Public API changes documented in changelogs (optional)

@poljar poljar requested a review from a team as a code owner February 5, 2025 13:57
@poljar poljar requested review from bnjbvr and removed request for a team February 5, 2025 13:57
@poljar poljar force-pushed the poljar/delete-4s-whith-recovery branch from 1e43495 to 53b104c Compare February 5, 2025 13:58
@poljar poljar requested a review from davidegirardi February 5, 2025 13:59
Copy link
Member

@bnjbvr bnjbvr left a comment

Choose a reason for hiding this comment

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

TIL there's no endpoint to remove global account data, and one can only reset them to default values 🥴

Anyhow, thanks, the patch looks good.

let content = SecretEventContent::new(Default::default());
let secret_content = Raw::from_json(
to_raw_value(&content)
.expect("We should be able to serialize a raw empty secret event content"),
Copy link
Member

Choose a reason for hiding this comment

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

Any chance we could use a plain ? here, since this function returns a Result type anyways?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

As the recovery module has a specialized error type we can't just use ? to convert the error. We either need to add a error variant for this or muck it somewhere into the matrix_sdk::Error type.

But I don't think it makes much sense, serializing the default event content should never fail.

Copy link
Member

Choose a reason for hiding this comment

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

Makes sense to keep it like this, then 👍

@poljar
Copy link
Contributor Author

poljar commented Feb 5, 2025

Oh my god, you can't upload the empty content? Good thing I made an integration test.

Copy link

@davidegirardi davidegirardi left a comment

Choose a reason for hiding this comment

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

Sounds reasonable. Do we need to delete (or overwrite with empty JSONs) the room keys too?

@poljar
Copy link
Contributor Author

poljar commented Feb 6, 2025

Sounds reasonable. Do we need to delete (or overwrite with empty JSONs) the room keys too?

No, the backup API has a DELETE method on the server.

@richvdh richvdh requested review from a team and BillCarsonFr and removed request for a team February 6, 2025 08:24
Copy link
Member

@BillCarsonFr BillCarsonFr left a comment

Choose a reason for hiding this comment

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

We might want also to delete the actual key

Copy link

codecov bot commented Feb 11, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 85.74%. Comparing base (ed8c1d5) to head (56c25f3).
Report is 17 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4629      +/-   ##
==========================================
+ Coverage   85.72%   85.74%   +0.02%     
==========================================
  Files         292      292              
  Lines       33490    33506      +16     
==========================================
+ Hits        28709    28730      +21     
+ Misses       4781     4776       -5     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@poljar poljar force-pushed the poljar/delete-4s-whith-recovery branch from 409fbe9 to c444bc9 Compare February 11, 2025 13:44
@poljar poljar force-pushed the poljar/delete-4s-whith-recovery branch from b1264c1 to 56c25f3 Compare February 11, 2025 14:00
@poljar poljar merged commit 8042abe into main Feb 11, 2025
41 checks passed
@poljar poljar deleted the poljar/delete-4s-whith-recovery branch February 11, 2025 14:28
// deserialize the content and find out the key ID.
//
// Then we finally set the event to an empty JSON content.
if let Ok(Some(default_event)) =
Copy link
Member

Choose a reason for hiding this comment

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

As an aside, I think that referring to account data as an "event" which can be "deleted" or changed in any way, is a confusing anti-pattern. One of the defining properties of an "event" in most environments is that it's something that happened in the past, so changing it is nonsense.

(I know that the spec uses that term, but I'd like that to change (matrix-org/matrix-spec#2030), and we can avoid spreading the mess any further in the meantime.)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

So, what should we call them?

Copy link
Member

Choose a reason for hiding this comment

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

"Account data". Or possibly, "Account data entries".

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.

5 participants