Skip to content

MediaProxy: refuse to serve media whose source event has been redacted - #527

Open
nbuechner wants to merge 1 commit into
matrix-org:developfrom
nbuechner:fix/media-redaction
Open

MediaProxy: refuse to serve media whose source event has been redacted#527
nbuechner wants to merge 1 commit into
matrix-org:developfrom
nbuechner:fix/media-redaction

Conversation

@nbuechner

Copy link
Copy Markdown

Summary

  • The proxy previously fetched media purely by its MXC URI, so a redacted event's media (e.g. NSFW content removed on Matrix) remained accessible to anyone who still had the proxy URL.
  • generateMediaUrl() now optionally binds the source room/event into the signed media token.
  • The download handler checks unsigned.redacted_because on the source event before proxying, refusing (404) if the event has been redacted or can't be verified.
  • Token format bumped to v2 (embeds room/event ID); v1 tokens still decode for backward compatibility during rolling upgrades.

Test plan

  • Added unit tests covering: encoding/decoding room+event in the token, refusing redacted media, refusing when the source event can't be verified.
  • Full existing test suite passes.
  • Verified against a live production bridge (matrix-appservice-irc).

Fixes matrix-org/matrix-appservice-irc#1849

The proxy previously fetched media purely by its MXC URI, so a redacted
event's media (e.g. NSFW content removed on Matrix) remained accessible
to anyone who still had the proxy URL. generateMediaUrl() now optionally
binds the source room/event into the signed media token, and the
download handler checks unsigned.redacted_because before proxying.

Fixes matrix-org/matrix-appservice-irc#1849
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.

redacted media via MediaProxy

1 participant