fix(server): reject malformed UTF-8 Control API bodies - #90
Merged
Conversation
|
Warning Review limit reached
On-demand reviews are free for the next 14 days. After that, they cost $0.25 per reviewed file. Or wait 16 minutes for your next included review. View limit detailsLimit details: You’ve used the included review currently available. Review configuration: ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Team Run ID: 📒 Files selected for processing (3)
Comment |
xuedingjie
force-pushed
the
fix/control-utf8
branch
from
September 6, 2026 16:34
a416cbe to
408f7d1
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The authenticated Control API decoded JSON request bodies with the default
TextDecoder. Malformed UTF-8 was replaced withU+FFFDand then accepted byJSON.parse, so fields such as Variable values could be silently changed before validation and persistence.Fix
Use a fatal UTF-8 decoder for Control API JSON bodies. Decoding failures continue to use the existing
400invalid-request response. Add a regression test proving that malformed bytes neither succeed nor persist a Variable.This aligns Control API input handling with the strict decoder already used by the Integration and Webhook callback paths and with RFC 8259 section 8.1.
Verification
npx --yes bun@1.4.0 x vitest run --config vitest.config.ts test/control.test.tsnpx --yes bun@1.4.0 x oxfmt --check apps/server/node/control.ts apps/server/test/control.test.tsnpx --yes bun@1.4.0 x oxlint --deny-warnings apps/server/node/control.ts apps/server/test/control.test.tsnpx --yes bun@1.4.0 x tsc --noEmit -p apps/server/tsconfig.json