feat: Allow room moderators to view redacted event content (MSC2815) #2245
No reviewers
Labels
No labels
Abandoned
Blocked
Bug
Changelog
Added
Changelog
Missing
Changelog
None
Cherry-picking
Database
Dependencies
Dependencies/Renovate
Difficulty
Easy
Difficulty
Hard
Difficulty
Medium
Documentation
Enhancement
Good first issue
Help wanted
Inherited
Matrix/Administration
Matrix/Appservices
Matrix/Auth
Matrix/Client
Matrix/Core
Matrix/E2EE
Matrix/Federation
Matrix/Hydra
Matrix/MSC
Matrix/Media
Matrix/T&S
Merge
Merge/Manual
Merge/Squash
Meta
Meta/CI
Meta/Packaging
Priority
Blocking
Priority
High
Priority
Low
Security
Status
Confirmed
Status
Duplicate
Status
Invalid
Status
Needs Investigation
Support
bob the builder
compliance
No assignees
4 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
continuwuation/continuwuity!2245
Loading…
Reference in a new issue
No description provided.
Delete branch "eleboucher/continuwuity:feat/msc2815-unredacted-content"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
This pull request...
Pull request checklist:
mainbranch, and the branch is named something other thanmain.myself, if applicable. This includes ensuring code compiles.
@ -0,0 +1 @@Added [MSC2815](https://github.com/matrix-org/matrix-spec-proposals/pull/2815), letting room moderators fetch the content of redacted events, behind the `allow_moderators_to_view_redacted_content` config option. Contributed by @eleboucher.@ -8,0 +14,4 @@#[derive(Deserialize)]pub(crate) struct Msc2815Params {#[serde(rename = "fi.mau.msc2815.include_unredacted_content", default)]include_unredacted_content: Option<String>,Some reason not to
Option<bool>?@ -50,0 +101,4 @@Ok(())}fn content_unavailable() -> Error {This should probably just be inlined? I only see one callsite
@ -1701,0 +1707,4 @@////// default: false#[serde(default)]pub allow_moderators_to_view_redacted_content: bool,There's going to need to be a way to define a lifetime for unredacted content before it is truly deleted from the db (maybe a default of 90d?), otherwise people will complain the server doesn't respect redactions at all, and also that it'll cause abusive content to remain in the db forever. A purge task will also probably be necessary instead of just deleting when the expired entry is requested, since they may never be requested
done boss
0a1eddb1b604862cb54e04862cb54ee9cfb8c11bThe reason why I didn't merge it when I did this before is because I wanted to avoid doing a redundant move of the data into a new column and instead handle redactions as relations, doing the redaction of retained events on access.
@Jade wrote in #2245 (comment):
Tulir told me to do it so i did, i didn't look or anything but just respect orders
@Jade wrote in #2245 (comment):
tbh I think that can just be a future improvement, that's a significantly more complex thing than this is, and I'm quite happy to get a cheap win. It's not like this is too hot of a path anyway
e9cfb8c11b8198fb72bcA few minor nitpicks, otherwise lgtm
@ -70,0 +97,4 @@.await;if power_levels.for_user(sender_user) < power_levels.redact&& !services.users.is_admin(sender_user).awaitnit: It'd be cheaper to check instance admin status before power level fetching
@ -87,6 +93,8 @@ struct Services {users: Dep<users::Service>,}const PURGE_INTERVAL_SECS: u64 = 60 * 60;nit: plain
3600would be more legible@ -45,6 +45,15 @@ impl super::Service {.get_room_version(&pdu.room_id_or_hash()).await?;if !pdu.is_redacted()nit: I wonder if it'd be more reliable to check if the content hash check fails instead of whether the PDU is explicitly redacted 🤔
6bf5a361bc8c278d04488c278d0448c6093304dfc6093304dfc471de46f4Good enough to be honest, considering we're not refactoring the database here
c471de46f4513ab412c2513ab412c28603ae21ccthis needs
cargo buildrun, so the env variables are put in the example config, I think. but otherwise ready2609cc4426ea3beb628a