Skip to content

Customer chat: rejected MIME types are accepted when the filename extension matches #1374

Description

@marassteiner

Follow-up from #1297 (not a merge blocker).

Evidence

src/screens/chat.screen.tsx:44 (isAcceptedAttachment): if file.type is present but not in ACCEPTED_MIME_TYPES, the function still returns true when the name ends with .pdf / .jpeg / .jpg / .png.

A file named payload.png with type: image/svg+xml or text/html is therefore accepted. isImageFile (line 51) then treats any image/* MIME as a preview candidate.

The composer preview sink itself is still only a blob: object URL (asBlobPreviewUrl at line 60), so this is a type-policy gap, not an HTML injection path.

Suggested fix

Fall back to the extension only when file.type is empty. If a MIME type is present, it must be in the allow-list. Restrict isImageFile to image/jpeg, image/jpg, and image/png.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions