Repository navigation
fix(psr7): reject CR, LF and NUL in header values - #14806
Conversation
PSR-7 requires implementations to refuse header values that would break message framing. Webhook names are free text and end up in the X-Appwrite-Webhook-Name header, so the worker strips control characters from the name rather than letting the delivery fail.
|
Review complete. No issues found — approved ✅. This PR hardens the webhook delivery path against header injection by stripping control characters from the webhook name before it is sent as a header, and tightens the PSR-7 message layer's header value validation.
One low-severity residual was noted but kept below the reporting threshold: Reviewed commit: 1ee58d3 |
🟢 Tier S · Ready to merge
The PSR-7 message implementation now rejects header values containing CR, LF, or NUL, with unit coverage for both header methods and accepted tab/Unicode values. Webhook delivery removes control characters from webhook names before setting the name header, with an end-to-end regression test.
📂 Walkthrough · 5
Reviewed |
✨ Benchmark resultsComparing
Per-scenario breakdown & investigation detailsMetrics below reflect the current branch (after). Δ P95 compares against the base.
Top API waits (after)
|
Security rulesNo new WARNING or ERROR findings from security rules. 6 existing findings tracked in
|
…rol-characters fix(psr7): reject CR, LF and NUL in header values (cherry picked from commit 594b29c)
Summary
Utopia\Psr7\Message::withHeader()andwithAddedHeader()now throwInvalidArgumentExceptionfor header values containing CR, LF or NUL, as PSR-7 requires.The webhooks worker sends the webhook name in
X-Appwrite-Webhook-Name. Names are free text, so the worker strips control characters from the name before using it as a header value, keeping deliveries for such webhooks working.Test plan
bin/monorepo check psr7andbin/monorepo test psr7: new data-provider tests cover CR, LF, CRLF, NUL and a list containing a bad value for both methods; tabs and non-ASCII stay acceptedWebhooksCustomServerTest::testWebhookNameWithLineBreaksIsDelivered: a webhook named with CR/LF/tab is delivered once, with those characters removed from the headerRelated: appwrite-labs/cloud#6674