bb-plane-fork/packages
binarybeach d950222749 binarybeachio: fix presigned-PUT signature mismatch on empty Content-Type
Plane's frontend calls getFileMetaDataForUpload() which uses the file-type
library to sniff MIME from magic bytes. For unsniffable formats (plain text,
.json, .csv, etc.) it returns "" — and that empty string was being threaded
through to S3Storage.generate_presigned_post(), signing the presigned URL
with `Content-Type=""`. Browsers can't reliably send an empty Content-Type
header, so the SigV4 signature never matched and R2 returned 403
SignatureDoesNotMatch. UI showed an opaque upload error.

Two-sided fix:
* apps/api/plane/settings/storage.py — default file_type to
  "application/octet-stream" when empty/None. The signed URL now always has
  a non-empty Content-Type the browser can match.
* packages/services/src/file/helper.ts — generateFileUploadPayload now
  prefers the signed Content-Type from upload_data.fields["Content-Type"]
  over file.type. The browser must send EXACTLY the signed value, not its
  own MIME guess from extension. Belt-and-suspenders defense alongside the
  backend default.

Reproduced empirically against R2 with the new keys 2026-05-01: empty
Content-Type signs, then PUT with `Content-Type: text/plain` returns 403
SignatureDoesNotMatch. With this patch, signing "application/octet-stream"
+ sending it back verbatim returns 200.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-01 00:30:24 -10:00
..
codemods chore: version bump 2026-03-31 17:09:35 +05:30
constants chore: version bump 2026-03-31 17:09:35 +05:30
decorators fix: tsdown watch (#8813) 2026-03-27 15:59:55 +05:30
editor chore: version bump 2026-03-31 17:09:35 +05:30
hooks chore: version bump 2026-03-31 17:09:35 +05:30
i18n chore: version bump 2026-03-31 17:09:35 +05:30
logger chore: version bump 2026-03-31 17:09:35 +05:30
propel chore: version bump 2026-03-31 17:09:35 +05:30
services binarybeachio: fix presigned-PUT signature mismatch on empty Content-Type 2026-05-01 00:30:24 -10:00
shared-state chore: version bump 2026-03-31 17:09:35 +05:30
tailwind-config chore: version bump 2026-03-31 17:09:35 +05:30
types binarybeachio: presigned PUT for uploads (R2/B2 don't implement PostObject) 2026-04-30 17:56:52 -10:00
typescript-config chore: version bump 2026-03-31 17:09:35 +05:30
ui chore: version bump 2026-03-31 17:09:35 +05:30
utils chore: version bump 2026-03-31 17:09:35 +05:30