-
Notifications
You must be signed in to change notification settings - Fork 269
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
Conversation
poljar
commented
Feb 5, 2025
- Public API changes documented in changelogs (optional)
1e43495
to
53b104c
Compare
There was a problem hiding this 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"), |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 👍
Oh my god, you can't upload the empty content? Good thing I made an integration test. |
There was a problem hiding this 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?
No, the backup API has a |
There was a problem hiding this 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
Codecov ReportAll modified and coverable lines are covered by tests ✅
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. |
409fbe9
to
c444bc9
Compare
b1264c1
to
56c25f3
Compare
// 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)) = |
There was a problem hiding this comment.
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.)
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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".