Skip to content

Matrix failed media with MSC3916 "Authentication for media" #2184

@mahdi1234

Description

@mahdi1234

With recent switch on many matrix servers to authenticated media, matterbridge doesn't handle it correctly anymore even when Media server set. With v1.26.0

time="2024-09-06T13:23:47+02:00" level=debug msg="== Receiving event: &gomatrix.Event{StateKey:(*string)(nil), Sender:"@someaccount:matrix.org", Type:"m.room.message", Timestamp:1725621827645, ID:"$someid", RoomID:"!someroom:matrix.org", Redacts:"", Unsigned:map[string]interface {}{"age":301, "membership":"join"}, Content:map[string]interface {}{"body":"barcode.gif", "info":map[string]interface {}{"h":100, "mimetype":"image/gif", "size":1676, "w":100, "xyz.amorgan.blurhash":"xyz"}, "m.mentions":map[string]interface {}{}, "msgtype":"m.image", "url":"mxc://matrix.org/someurl"}, PrevContent:map[string]interface {}(nil)}" func=handleEvent file="bridge/matrix/matrix.go:484" prefix=matrix
time="2024-09-06T13:23:48+02:00" level=debug msg="Trying to download "barcode.gif" with size 1676" func=HandleDownloadSize file="bridge/helper/helper.go:162" prefix=matrix
time="2024-09-06T13:23:48+02:00" level=debug msg="Download OK "barcode.gif" 45" func=HandleDownloadData2 file="bridge/helper/helper.go:183" prefix=matrix

In the snippet above, there was image called barcode.gif with size of 1676 bytes posted, but in reality only 45 bytes downloaded.

Content of that file shows it wasn't properly authenticated.

cat ./barcode.gif 
{"errcode":"M_NOT_FOUND","error":"Not found"}

Here's some context:
matrix-org/matrix-spec-proposals#3916
https://matrix.org/blog/2024/06/26/sunsetting-unauthenticated-media/

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions