feat(llc): Sanitize X-Stream-Client to prevent customers overriding internal values (v9)#2799
feat(llc): Sanitize X-Stream-Client to prevent customers overriding internal values (v9)#2799VelikovPetar wants to merge 2 commits into
X-Stream-Client to prevent customers overriding internal values (v9)#2799Conversation
Co-Authored-By: Claude <noreply@anthropic.com>
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
X-Stream-Client to prevent customers overriding internal values
X-Stream-Client to prevent customers overriding internal valuesX-Stream-Client to prevent customers overriding internal values (v9)
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## v9 #2799 +/- ##
=====================================
Coverage ? 66.32%
=====================================
Files ? 429
Lines ? 27114
Branches ? 0
=====================================
Hits ? 17983
Misses ? 9131
Partials ? 0 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Submit a pull request
Linear: FLU-565
Github Issue: #
Backport of: #2790
CLA
Description of the pull request
Hardens the
X-Stream-Clientheader so SDK-identifying metadata can't be spoofed viaStreamChatClient.updateSystemEnvironmentor overridden through custom WebSocket query parameters.SystemEnvironmentManagernow sanitizes anySystemEnvironmentit receives (both in the constructor and inupdateEnvironment):sdkName(locked tostream-chat)sdkVersion(locked toPACKAGE_VERSION)osName(locked toCurrentPlatform.name)sdkIdentifier— only the one-waydart→flutterpromotion is accepted. Aflutter→dartdemotion and any unknown identifier fall back to the current value. This lets the Flutter UI layer upgrade the identifier while preventing downgrades/spoofing.appName,appVersion,osVersion,deviceModelWebSocket header ordering — the
X-Stream-Clientheader is now applied after...queryParametersin the connection params, so caller-supplied query parameters can no longer override it.Doc comments on
StreamChatClient.updateSystemEnvironmentwere updated to document the overridable vs. immutable fields.Test instructions
Covered by unit tests in
system_environment_manager_test.dart:sdkIdentifierfalls back)sdkIdentifierdart→flutterflutter→dartRun:
melos run test --scope=stream_chat(or the single file above).Screenshots / Videos
No UI changes.