Skip to content

fix(server): reject malformed UTF-8 webhook payloads - #89

Merged
l1shen merged 1 commit into
oomol-lab:mainfrom
xuedingjie:fix/webhook-utf8
Sep 7, 2026
Merged

fix(server): reject malformed UTF-8 webhook payloads#89
l1shen merged 1 commit into
oomol-lab:mainfrom
xuedingjie:fix/webhook-utf8

Conversation

@xuedingjie

Copy link
Copy Markdown
Contributor

Problem

readWebhookPayload decoded request bytes with the default TextDecoder, which replaces malformed UTF-8 sequences with U+FFFD. A malformed JSON request could therefore be accepted after its payload was silently rewritten, and a Run would be created with data different from the bytes sent by the caller.

Fix

Decode Webhook bodies with a fatal UTF-8 decoder and map decoding failures to the existing 400 invalid-request response. Add a regression test that sends an invalid UTF-8 sequence and verifies that no Run is created.

This matches the strict decoder already used by the Integration callback path and the JSON UTF-8 requirement in RFC 8259 section 8.1.

Verification

  • npx --yes bun@1.4.0 x vitest run --config vitest.config.ts test/webhook.test.ts
  • npx --yes bun@1.4.0 x oxfmt --check apps/server/node/http.ts apps/server/test/webhook.test.ts
  • npx --yes bun@1.4.0 x oxlint --deny-warnings apps/server/node/http.ts apps/server/test/webhook.test.ts
  • npx --yes bun@1.4.0 x tsc --noEmit -p apps/server/tsconfig.json

@coderabbitai

coderabbitai Bot commented Sep 6, 2026

Copy link
Copy Markdown

Warning

Review limit reached

  • Run on-demand review

On-demand reviews are free for the next 14 days. After that, they cost $0.25 per reviewed file.

Or wait 30 minutes for your next included review.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Team

Run ID: 214e4b85-9bf9-46b9-b33b-2decaa626ce6

📥 Commits

Reviewing files that changed from the base of the PR and between 59bec4a and fc300a3.

📒 Files selected for processing (2)
  • apps/server/node/http.ts
  • apps/server/test/webhook.test.ts

Comment @coderabbitai help to get the list of available commands.

@l1shen
l1shen merged commit 5533989 into oomol-lab:main Sep 7, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants