Skip to content

fix: backport library security fixes to 1.9.x - #14909

Merged
ChiragAgg5k merged 4 commits into
1.9.xfrom
fix/1.9.x-security-http
Oct 24, 2026
Merged

ChiragAgg5k merged 4 commits into
1.9.xfrom
fix/1.9.x-security-http

Conversation

@ChiragAgg5k

@ChiragAgg5k ChiragAgg5k commented Oct 24, 2026 •

Copy link
Copy Markdown
Member

Backports the security fixes that live in libraries 1.9.x vendors. 1.9's dependency set caps utopia-php/http at rc16 and utopia-php/vcs at 4.5.1, both older than the fixes, so the guards are applied in Appwrite's own code.

PR Fix 1.9.x
#14897 Client-named Swoole-Upload-File uploads Ported to Appwrite\Utopia\Request
#14792 Request values called as callables Ported to Request::getParams(): callable values are dropped before the framework sees them
#14802 VCS API calls skip TLS verification Appwrite\Utopia\VCS\Adapter\Git\GitHub verifies (GitHub is the only provider on 1.9)
#14806 CR/LF in webhook headers Ported to the webhooks worker (the psr7 part doesn't apply)
#14826 VCS prints request params on provider 500s Not ported: low severity, would need a copy of Adapter::call()
#14865, #14866, #14887 telemetry OTLP TLS, query AST, cdn Not applicable: 1.9 doesn't use the OTLP Swoole transport, its query version has no AST, and it has no cdn package
tests/unit/Utopia/RequestTest.php   19 passed; 3 of the new tests fail without the fix
tests/unit/Utopia/VCS/GitHubTest.php
tests/e2e/Services/Webhooks/WebhooksCustomServerTest.php::testWebhookNameWithLineBreaksIsDelivered

Related: appwrite-labs/cloud#6674

…lues (backport #14897, #14792)

Swoole accepts a Swoole-Upload-File part header as a ready temp file, so a client could name any server path as its upload and have it unlinked. The framework also calls any callable argument, so a request value such as ["Class", "method"] ran as code. The 1.9 dependency set caps utopia-php/http below the releases that fix both, so the request wrapper applies the guards.
utopia-php/vcs 4.x accepts self-signed certificates on every provider API call by default.
@luxor-code-review

luxor-code-review Bot commented Oct 24, 2026 •

Copy link
Copy Markdown

Review complete. No blocking issues — approved ✅; 2 nitpicks below.

🧹 Nitpicks (2) — 🟢 2 low
  • 🟢 Builds worker still uses permissive TLS adapter (Builds.php) — The TLS hardening takes effect only through the DI wiring in app/init/resources.php:345, but the Builds worker constructs the base library adapter directly at src/Appwrite/Platform/Modules/Functions/Workers/Builds.php:133 with the original Utopia\VCS\Adapter\Git\GitHub import (line 45), whose selfSigned default still accepts self-signed certificates.
  • 🟢 Callable filter can drop legitimate array params (Request.php:46) — The new guard in getParams drops any request value for which is_callable() returns true unless it is a string (src/Appwrite/Utopia/Request.php:46-49).

The PR adds three security mitigations: scrubbing client-supplied spoofed upload paths from Swoole's parsed files, stripping control characters from webhook names before they are placed into HTTP headers, and disabling self-signed certificate acceptance for the GitHub VCS adapter. Tests cover the new request filtering and the GitHub adapter behavior.

Files Change
src/Appwrite/Utopia/Request.php, tests/unit/Utopia/RequestTest.php Scrub spoofed tmpfiles/files entries from Swoole multipart parsing and filter callable-shaped request params, with unit tests
src/Appwrite/Platform/Workers/Webhooks.php, tests/e2e/Services/Webhooks/WebhooksCustomServerTest.php Strip control characters from webhook names before header emission, with an e2e test
src/Appwrite/Utopia/VCS/Adapter/Git/GitHub.php, app/init/resources.php, tests/unit/Utopia/VCS/GitHubTest.php New adapter subclass with certificate verification enforced and DI wiring swapped, with unit tests
src/Appwrite/Platform/Modules/Functions/Workers/Builds.php Unchanged but noted: still instantiates the base permissive GitHub adapter directly

Reviewed commit: d37b3cb

@ghost

ghost commented Oct 24, 2026 •

Copy link
Copy Markdown

🟢 Tier S · Ready to merge

The reviewed guards address the stated security cases, and the changed behaviors have relevant test coverage.

This backport adds request guards for spoofed Swoole upload paths and callable request values, verifies TLS for GitHub VCS API calls, and removes control characters from webhook-name headers. It also adds unit and end-to-end coverage for these behaviors.

Verdict New comments Fixed Still open
✅ Approved 0 0 0
📂 Walkthrough · 8
File Change
app/init/resources.php Registers the Appwrite GitHub adapter with TLS verification enabled.
src/Appwrite/Platform/Modules/Functions/Workers/Builds.php Uses the TLS-verifying GitHub adapter when creating it in the build worker.
src/Appwrite/Platform/Workers/Webhooks.php Strips control characters from webhook names before sending them as headers.
src/Appwrite/Utopia/Request.php Drops callable request values and neutralizes client-specified Swoole upload paths.
src/Appwrite/Utopia/VCS/Adapter/Git/GitHub.php Adds a GitHub adapter subclass that disables self-signed certificate acceptance.
tests/e2e/Services/Webhooks/WebhooksCustomServerTest.php Covers delivery of webhook names containing line breaks.
tests/unit/Utopia/RequestTest.php Covers callable parameter filtering and spoofed upload handling, including nested fields.
tests/unit/Utopia/VCS/GitHubTest.php Checks that the GitHub adapter rejects self-signed certificates.

Reviewed 44d7f31 · Details · Comment @hansi-codes review to re-run, or mention @hansi-codes with a question.

@ChiragAgg5k ChiragAgg5k self-assigned this Oct 24, 2026
ghost
ghost previously requested changes Oct 24, 2026

@ghost ghost left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Tier B · 1 blocking finding to address. Summary

@github-actions

github-actions Bot commented Oct 24, 2026 •

Copy link
Copy Markdown

✨ Benchmark results

Comparing 1.9.x (before) to fix/1.9.x-security-http (after).

Before

Scenario P50 (ms) P95 (ms) Requests RPS
API total 12.98 126.35 185 35.02
Account 27.87 192.94 35 7.36
TablesDB 12.83 18.77 35 8.66
Storage 11.57 91.23 75 18.06
Functions 22.89 30.28 40 9.7

After

Scenario P50 (ms) P95 (ms) Requests RPS
API total 13.19 128.14 185 34.52
Account 26.83 152.05 35 7.25
TablesDB 12.73 19.2 35 8.49
Storage 11.56 113.92 75 17.81
Functions 24.13 33.26 40 9.53

Delta

Scenario P95 delta (ms)
API total +1.79
Account -40.88
TablesDB +0.44
Storage +22.68
Functions +2.98
Top API waits
API request Max wait (ms)
account.sessions.email.create 553.49
account.create 151.9
account.password.update 150.28

@github-actions

github-actions Bot commented Oct 24, 2026 •

Copy link
Copy Markdown

🔄 PHP-Retry Summary

Flaky tests detected across commits:

Commit d37b3cb - 1 flaky test
Test Retries Total Time Details
DocumentsDBCustomServerTest::testEnforceCollectionPermissions 1 1.28s Logs
Commit 44d7f31 - 1 flaky test
Test Retries Total Time Details
FunctionsScheduleTest::testDeleteScheduledExecution 1 7.99s Logs

@ChiragAgg5k

Copy link
Copy Markdown
Member Author

@hansi-codes review

@ghost
ghost dismissed their stale review October 24, 2026 11:45

The findings that requested changes are resolved. See the summary comment for what is still open.

@ghost ghost left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Tier S · Looks good to merge. Summary

@ghost ghost left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Tier S · Looks good to merge. Summary

@ChiragAgg5k
ChiragAgg5k merged commit dc9a672 into 1.9.x Oct 24, 2026
47 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.

1 participant