8go / 8go/matrix-commander

Sending encrypted files in unencrypted room

Open
#209 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
754
Forks
69
PR merge metrics
No merged PRs in 30d

Description

When I run `matrix-commander -i test.png` to send an image to an unencrypted room, some clients such as Nheko fail to display the image. This appears to happen because matrix-commander is sending the image encrypted, even though the room is *not* encrypted.

The Matrix spec is not 100% clear to me on whether or not this is allowed, but it seems at least discouraged by the sentence "When encryption is enabled in a room, files should be uploaded encrypted on the homeserver." (https://spec.matrix.org/v1.17/client-server-api/#sending-encrypted-attachments)

Further, matrix-commander itself isn't very happy about it:

```
root@blue:~# matrix-commander -i test.png
2026-01-20 17:42:35,712: WARNING: nio.events.misc: Error validating event: 'url' is a required property

Failed validating 'required' in schema['properties']['content']:
{'type': 'object',
'properties': {'body': {'type': 'string'},
'url': {'type': 'string'},
'msgtype': {'type': 'string',
'enum': ['m.image',
'm.audio',
'm.video',
'm.file']}},
'required': ['body', 'url', 'msgtype']}

On instance['content']:
{'body': 'drive.jpg',
'info': {'size': 520596,
'mimetype': 'image/jpeg',
'w': 2560,
'h': 1440,
'xyz.amorgan.blurhash': None},
'msgtype': 'm.image',
'file': {'url': 'mxc://',
'key': {'kty': 'oct',
'alg': 'A256CTR',
'ext': True,
'k': '',
'key_ops': ['encrypt', 'decrypt']},
'iv': '9sYw2J7VftwAAAAAAAAAAA',
'hashes': {'sha256': 'rkavhUk/zBs8XJMORwzncQikFWD6L9oYL/FJU0jwRPU'},
'v': 'v2'}}
2026-01-20 17:42:36,277: INFO: matrix-commander: This image file was sent: "stonks.png" to room "" as event "".
```

This validation failure reflects the issue, per the spec `url` is required for unencrypted media while `file` is required for encrypted media (https://spec.matrix.org/v1.17/client-server-api/#mimage).

Adding `--plain` does not change the behavior.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.