mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-12-01 17:03:15 +00:00
fix(media): bound image work before public rendition
Check avatar uploads and raster fallbacks before decoding. Limit compressed bytes, decoded dimensions, GIF frames and the combined TIFF page budget.
This commit is contained in:
@@ -168,6 +168,17 @@ describe('Avatar', () => {
|
||||
expect(res.status).toBe(400);
|
||||
});
|
||||
|
||||
it('PROFILE-003b: checks the avatar bytes before storing it', async () => {
|
||||
const { user } = await makeUser(orm);
|
||||
const res = await request(app)
|
||||
.post('/api/auth/avatar')
|
||||
.set('Cookie', authCookie(user.id))
|
||||
.attach('avatar', Buffer.from('not an image'), { filename: 'avatar.png', contentType: 'image/png' });
|
||||
|
||||
expect(res.status).toBe(400);
|
||||
expect(await findRow(orm, Users, { id: user.id })).toMatchObject({ avatar: null });
|
||||
});
|
||||
|
||||
it('PROFILE-005 — DELETE /api/auth/avatar clears avatar_url', async () => {
|
||||
const { user } = await makeUser(orm);
|
||||
// Upload first
|
||||
|
||||
Reference in New Issue
Block a user