10BC0 Sending encrypted files in unencrypted room · Issue #209 · 8go/matrix-commander · GitHub
[go: up one dir, main page]

Skip to content

Sending encrypted files in unencrypted room #209

@jcrawfordor

Description

@jcrawfordor

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://<snip>',
              'key': {'kty': 'oct',
                      'alg': 'A256CTR',
                      'ext': True,
                      'k': '<snip>',
                      '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 "<snip>" as event "<snip>".

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0