Skip to content

fix: multipart channel uploads and tokens for short API secrets - #148

Merged
mogita merged 2 commits into
masterfrom
fix/cha-7711-eval-defects
Dec 4, 2026
Merged

mogita merged 2 commits into
masterfrom
fix/cha-7711-eval-defects

Conversation

@mogita

@mogita mogita commented Dec 4, 2026

Copy link
Copy Markdown
Collaborator

Ticket

https://linear.app/stream/issue/CHA-7711/generated-server-sdks-defects-found-by-the-migration-skill-eval

Problem

uploadChannelFile and uploadChannelImage sent JSON instead of multipart, because makeRequest only sent multipart for FileUploadRequest and ImageUploadRequest. firebase/php-jwt 7 refuses an API secret shorter than 32 bytes, so every call failed with one.

Solution

  • makeRequest also sends UploadChannelFileRequest and UploadChannelRequest as multipart.
  • JWTGenerator signs HS256, HS384 and HS512 tokens itself. verifyToken still decodes through php-jwt.

How to verify

  1. vendor/bin/phpunit --filter 'channelUploadsAreSentAsMultipart|shortSecretSignsTokens' tests/ClientTest.php

BEGIN_COMMIT_OVERRIDE
fix: send uploadChannelFile and uploadChannelImage as multipart
fix: sign tokens with API secrets shorter than 32 bytes
END_COMMIT_OVERRIDE

… secrets

uploadChannelFile and uploadChannelImage passed UploadChannelFileRequest and UploadChannelRequest, which makeRequest sent as JSON. php-jwt 7 refuses an HMAC key shorter than the hash, so the generator signs HS256/384/512 tokens itself.
@getstream-metis

getstream-metis Bot commented Dec 4, 2026 •

Copy link
Copy Markdown

👋 Thanks, 🌵! I'm on it.

How to work with me

  • 💬 Disagree with a finding? Reply in its thread and tell me why. I'll withdraw it, or answer with evidence.
  • 🔁 Fixed it? Just push. The next round checks your fix and resolves the thread.
  • 👍 👎 Rate my findings. I learn what your team doesn't want flagged.
  • ✅ I approve once nothing blocking is left: must-fix always blocks; should-fix blocks in the first two rounds, and after that until you fix it or reply in its thread. CI isn't part of that; branch protection still holds the merge until it's green. On repos that require a human approval, a teammate still has to approve too.
Commands

Comment any of these on the PR:

  • /jeffery review · start a review
  • /jeffery next-round · start the next round now
  • /jeffery pause · /jeffery resume · stop or restart reviews on this PR
  • /jeffery status · where things stand
  • /jeffery help · all commands

getstream-metis[bot]
getstream-metis Bot previously approved these changes Dec 4, 2026

@getstream-metis getstream-metis Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Round 1 · 🎉 Approved

Nice work, 🌵! Nothing blocking is left on 2b6d6802ed2d. Ship it 🚀

Worth a human look: Whether JWTGenerator::verifyToken (JWT::decode with Key) in php-jwt 7 rejects a short secret, so tokens from generateUserToken fail to verify; settle by reading php-jwt 7 JWT::decode/sign

@mogita
mogita enabled auto-merge (squash) December 4, 2026 16:05
@getstream-metis
getstream-metis Bot dismissed their stale review December 4, 2026 16:05

Withdrawing approval until 3a375c8 is reviewed.

@getstream-metis

getstream-metis Bot commented Dec 4, 2026 •

Copy link
Copy Markdown

✅ Nothing new to review. The latest push didn't change the code I reviewed (it was a rebase or a merge from the base branch), so my last review stands. See the checks tab for its current state.

@getstream-metis getstream-metis Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Round 1 · 🎉 Approved

Nice work, 🌵! Nothing blocking is left on 3a375c8dbed0. Ship it 🚀

Worth a human look: Whether JWTGenerator::verifyToken (JWT::decode with Key) in php-jwt 7 rejects a short secret, so tokens from generateUserToken fail to verify; settle by reading php-jwt 7 JWT::decode/sign

@mogita
mogita merged commit bd6a417 into master Dec 4, 2026
11 checks passed
@mogita
mogita deleted the fix/cha-7711-eval-defects branch December 4, 2026 16:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant