Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

We need a way of redacting offensive avatars and displaynames (SYN-566) #1458

Open
matrixbot opened this issue Dec 26, 2015 · 4 comments
Open
Labels
A-Moderation Tools for moderating HSes: event redaction, media removal, purge admin API, reports from users, ... O-Occasional Affects or can be seen by some users regularly or most users rarely S-Minor Blocks non-critical functionality, workarounds exist. T-Enhancement New features, changes in functionality, improvements in performance, or user-facing enhancements.

Comments

@matrixbot
Copy link
Member

Submitted by @​matthew:matrix.org
Currently the best you can do is redact the events which introduce the contents onto the timeline. However, the profile data remains intact and so the membership list etc continues as is. Given we have per-room profile data we should use it to redact the information from the room.

(Imported from https://matrix.org/jira/browse/SYN-566)

@matrixbot
Copy link
Member Author

Jira watchers: @ara4n

@matrixbot
Copy link
Member Author

To clarify: the redact API worked as intended (removing human readable contents of a join event: displayname and avatar). However, we have a seperate problem that the redacted data still leaks into the view of the room via the user's global profile data. I am proposing that redacting a this data on a join or profile event should also remove it from the per-room profile data (and that we should implement and uphold per-room profile data). This could be done as a synapse-specific feature for now, hence filing it here rather than blocking it on Matrix spec.

-- @ara4n

@matrixbot matrixbot added z-p2 (Deprecated Label) z-feature (Deprecated Label) labels Nov 7, 2016
@matrixbot matrixbot changed the title We need a way of redacting offensive avatars and displaynames (SYN-566) We need a way of redacting offensive avatars and displaynames (https://github.com/matrix-org/synapse/issues/1458) Nov 7, 2016
@matrixbot matrixbot changed the title We need a way of redacting offensive avatars and displaynames (https://github.com/matrix-org/synapse/issues/1458) We need a way of redacting offensive avatars and displaynames (SYN-566) Nov 7, 2016
@MadLittleMods
Copy link
Contributor

Related to element-hq/element-meta#1858

@erikjohnston erikjohnston added T-Enhancement New features, changes in functionality, improvements in performance, or user-facing enhancements. and removed z-feature (Deprecated Label) labels Sep 27, 2021
@PC-Admin
Copy link

PC-Admin commented Jan 17, 2023

Okay, here's a decent solution for this that doesn't involve nuking your entire remote media repository:

Example, let's start with the URL of the abusive image in question:
https://matrix.perthchat.org/_matrix/media/r0/download/matrix.org/eDmjusOjnHyFPOYGxlrOsULJ

First use the media_id (eDmjusOjnHyFPOYGxlrOsULJ) to find the filesystem_id with an SQL query:

$ /matrix/postgres/bin/cli-non-interactive --dbname=synapse -t -c "SELECT DISTINCT filesystem_id FROM remote_media_cache WHERE media_id = 'eDmjusOjnHyFPOYGxlrOsULJ'" | xargs
ehckzWWeUkDhhPfNFkcfCFNv

Then use that filesystem_id to locate the remote file and all it's thumbnails:

$ ssh matrix.perthchat.org "find /matrix/synapse/storage/media-store/remote_thumbnail/matrix.org/eh/ck/zWWeUkDhhPfNFkcfCFNv -type f -printf '%p\n'"
#/matrix/synapse/storage/media-store/remote_thumbnail/matrix.org/eh/ck/zWWeUkDhhPfNFkcfCFNv/32-32-image-jpeg-crop
#/matrix/synapse/storage/media-store/remote_thumbnail/matrix.org/eh/ck/zWWeUkDhhPfNFkcfCFNv/640-480-image-jpeg-scale
...
$ ssh matrix.perthchat.org "ls /matrix/synapse/storage/media-store/remote_content/matrix.org/eh/ck/zWWeUkDhhPfNFkcfCFNv"
/matrix/synapse/storage/media-store/remote_content/matrix.org/eh/ck/zWWeUkDhhPfNFkcfCFNv

Then zero each file and make it immutable:

$ ssh matrix.perthchat.org "true > /matrix/synapse/storage/media-store/remote_thumbnail/matrix.org/eh/ck/zWWeUkDhhPfNFkcfCFNv/32-32-image-jpeg-crop"
$ ssh matrix.perthchat.org "chattr +i /matrix/synapse/storage/media-store/remote_thumbnail/matrix.org/eh/ck/zWWeUkDhhPfNFkcfCFNv/32-32-image-jpeg-crop"
$ ssh matrix.perthchat.org "true > /matrix/synapse/storage/media-store/remote_thumbnail/matrix.org/eh/ck/zWWeUkDhhPfNFkcfCFNv/640-480-image-jpeg-scale"
$ ssh matrix.perthchat.org "chattr +i /matrix/synapse/storage/media-store/remote_thumbnail/matrix.org/eh/ck/zWWeUkDhhPfNFkcfCFNv/640-480-image-jpeg-scale"
...
$ ssh matrix.perthchat.org "true > /matrix/synapse/storage/media-store/remote_content/matrix.org/eh/ck/zWWeUkDhhPfNFkcfCFNv"
$ ssh matrix.perthchat.org "chattr +i /matrix/synapse/storage/media-store/remote_content/matrix.org/eh/ck/zWWeUkDhhPfNFkcfCFNv"

It's now possible to do all of this easily with my moderation script, first run the 'Redact a room event.' section:

16

Enter the internal id of the room the event is in (Example: !rapAelwZkajRyeZIpm:perthchat.org): !aYcTWHeXeJFQyPrplT:perthchat.org

Enter the event id of the event you wish to redact (Example: $lQT7NYYyVvwoVpZWcj7wceYQqeOzsJg1N6aXIecys4s): $va02kGTlS4zShUWz1e0QdrsDt3r3l9uYwqhhiB-KYPk

Enter the reason you're redacting this content: Evil Clown

Then finally run the 'Delete and block a specific media.' section:

26

Enter the media_id of the media you would like to delete and block on your server. (Example: For this media https://matrix.perthchat.org/_matrix/media/r0/download/matrix.org/eDmjusOjnHyFPOYGxlrOsULJ the media_id is 'eDmjusOjnHyFPOYGxlrOsULJ'): eDmjusOjnHyFPOYGxlrOsULJ

Enter the remote servers URL without the 'https://' (Example: matrix.org): matrix.org

It's that easy! xD

@MadLittleMods MadLittleMods added the A-Moderation Tools for moderating HSes: event redaction, media removal, purge admin API, reports from users, ... label Apr 3, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A-Moderation Tools for moderating HSes: event redaction, media removal, purge admin API, reports from users, ... O-Occasional Affects or can be seen by some users regularly or most users rarely S-Minor Blocks non-critical functionality, workarounds exist. T-Enhancement New features, changes in functionality, improvements in performance, or user-facing enhancements.
Projects
None yet
Development

No branches or pull requests

4 participants