~ knotless Search/
↑↓ move↵ open⇧↵ all results
0
0

Avatars and banners are not limited to the types the profile lexicon allows

Closed
Closed chadtmiller.com opened this issue 0 comments

What happened

profile.json and updateProfile.json accept only image/png and image/jpeg. The console's picker also offers webp, gif and avif, uploadImage keeps any Content-Type (even application/pdf), and updateProfile takes whatever mimeType the caller writes into the blob without comparing it with the stored blob. A webp chosen in the console therefore writes a profile record that its own lexicon rejects. A PDF can become the avatar, which /img then answers with 404, so the avatar shows broken.

How to see it

Read against docs/fresh at 4636e6d, the code at: group_config.rs:257-275 (upload_image), :160-165 (blob), :241-250; blobs.rs:150 (IMAGES); lexicons profile.json:28-40, updateProfile.json avatar/banner accept; web/src/lib/organisms/ProfilePictures.svelte:20. Paths are under crates/group-host/src unless they say otherwise. Severity: low.

What you expected

Widen the lexicons' accept to the five types in IMAGES. Refuse any other type in uploadImage, and in updateProfile take mimeType and size from the stored blob rather than from the caller.

Where

The host, as built from 4636e6d. Found while checking the docs against the code.