feat: harden attachment storage for level 4
This commit is contained in:
@@ -39,6 +39,12 @@ def main():
|
||||
client.call('POST', '/api/v1/chats/' + other_chat['id'] + '/messages', 404,
|
||||
actor=alice, headers={'Idempotency-Key': uuid.uuid4().hex},
|
||||
body={'text': '', 'attachment_ids': [attachment['id']]})
|
||||
client.call('POST', '/api/v1/chats/' + chat['id'] + '/messages', 404,
|
||||
actor=alice, headers={'Idempotency-Key': uuid.uuid4().hex},
|
||||
body={'text': '', 'attachment_ids': [str(uuid.uuid4())]})
|
||||
client.call('POST', '/api/v1/chats/' + chat['id'] + '/messages', 400,
|
||||
actor=alice, headers={'Idempotency-Key': uuid.uuid4().hex},
|
||||
body={'text': '', 'attachment_ids': [attachment['id'], attachment['id']]})
|
||||
|
||||
client.call('POST', upload_path, 415, actor=alice, raw=png,
|
||||
headers={'Content-Type': 'image/jpeg'})
|
||||
@@ -52,7 +58,7 @@ def main():
|
||||
downloaded = client.call('GET', '/api/v1/attachments/' + attachment['id'] + '/content',
|
||||
actor=bob)
|
||||
check(downloaded['bytes'] == original, 'authorized download changed bytes')
|
||||
print('PASS: foreign chat/user, MIME spoof, corruption, byte limit and filename checks')
|
||||
print('PASS: unknown/foreign attachment, foreign chat/user, MIME spoof, corruption, byte limit and filename checks')
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
Reference in New Issue
Block a user