Skip to content

Commit b99e6ee

Browse files
committed
Add report endpoint extension and clarify plaintext structure
1 parent 939e874 commit b99e6ee

File tree

1 file changed

+27
-5
lines changed

1 file changed

+27
-5
lines changed

proposals/4382-peppered-hash-verification.md

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,24 +41,46 @@ Where:
4141
}
4242
```
4343

44+
### Report Endpoint Extension
45+
46+
The content reporting endpoint is extended to include the plaintext event:
47+
48+
```
49+
POST /_matrix/client/v3/rooms/{roomId}/report/{eventId}
50+
{
51+
"reason": "Human-readable explanation",
52+
"plaintext": {
53+
"type": "m.room.message",
54+
"content": {"msgtype": "m.text", "body": "..."},
55+
"room_id": "!room:server"
56+
}
57+
}
58+
```
59+
60+
The `plaintext` field contains the full plaintext event structure that
61+
was fed into the encryption algorithm, as specified in the Megolm
62+
documentation. This is the same structure that clients decrypt when
63+
receiving encrypted events.
64+
4465
### Verification Process
4566

46-
When a user reports encrypted content, they provide the event ID and
47-
claimed plaintext. The server verifies:
67+
When a user reports encrypted content, the server verifies:
4868

4969
```python
50-
claimed_plaintext = canonical_json(report['plaintext'])
70+
plaintext_event = canonical_json(report['plaintext'])
5171
ciphertext = event['content']['ciphertext']
5272

53-
computed = base64(sha256(claimed_plaintext + ciphertext))
73+
computed = base64(sha256(plaintext_event + ciphertext))
5474

5575
if computed == event['content']['verification_hash']:
5676
# Report verified - plaintext is authentic
5777
else:
5878
# Report is false - reporter is lying
5979
```
6080

61-
The server never needs decryption keys or access to the plaintext.
81+
The server never needs decryption keys or access to the encryption
82+
session. It only verifies that the reported plaintext matches the
83+
verification hash.
6284

6385
### Security Properties
6486

0 commit comments

Comments
 (0)