Repository navigation
fix: multipart channel uploads and tokens for short API secrets - #148
Conversation
… 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.
👋 Thanks, 🌵! I'm on it.How to work with me
CommandsComment any of these on the PR:
|
There was a problem hiding this comment.
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
Withdrawing approval until 3a375c8 is reviewed.
|
✅ 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. |
There was a problem hiding this comment.
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
Ticket
https://linear.app/stream/issue/CHA-7711/generated-server-sdks-defects-found-by-the-migration-skill-eval
Problem
uploadChannelFileanduploadChannelImagesent JSON instead of multipart, becausemakeRequestonly sent multipart forFileUploadRequestandImageUploadRequest.firebase/php-jwt7 refuses an API secret shorter than 32 bytes, so every call failed with one.Solution
makeRequestalso sendsUploadChannelFileRequestandUploadChannelRequestas multipart.JWTGeneratorsigns HS256, HS384 and HS512 tokens itself.verifyTokenstill decodes through php-jwt.How to verify
vendor/bin/phpunit --filter 'channelUploadsAreSentAsMultipart|shortSecretSignsTokens' tests/ClientTest.phpBEGIN_COMMIT_OVERRIDE
fix: send uploadChannelFile and uploadChannelImage as multipart
fix: sign tokens with API secrets shorter than 32 bytes
END_COMMIT_OVERRIDE