Skip to content

fix(proxy): skip empty entries in the functions domain list - #13529

Merged
HarshMN2345 merged 4 commits into
mainfrom
fix/proxy-functions-domain-guard
Sep 8, 2026
Merged

HarshMN2345 merged 4 commits into
mainfrom
fix/proxy-functions-domain-guard

Conversation

@HarshMN2345

@HarshMN2345 HarshMN2345 commented Sep 8, 2026 •

Copy link
Copy Markdown
Member

Closes #11675

What does this PR do?

Checks the current functions-domain entry when skipping empty values, matching the existing sites-domain loop. An empty entry from a trailing comma previously created a restriction that rejected valid custom domains with more than two labels.

Test Plan

The Proxy CI job starts Appwrite with _APP_DOMAIN_FUNCTIONS=functions.localhost,. Existing Proxy E2E tests cover successful custom-domain creation and rejection of restricted domains through the API. The action unit test and its protected-method wrapper were removed.

The workflow setup was checked to apply this fixture only to Proxy. PHP syntax and diff checks passed; E2E validation runs in CI.

The guard inside the loop tested the whole comma-separated env string instead
of the current entry, so it could never skip an empty one. With any empty
segment in _APP_DOMAIN_FUNCTIONS - a trailing comma is enough - an empty
hostname reached the domain restriction, and str_ends_with() matches every
value against an empty needle, so every custom domain deeper than an apex was
rejected. The sites loop directly above already checks the loop variable.
@greptile-apps

greptile-apps Bot commented Sep 8, 2026 •

Copy link
Copy Markdown
Contributor

Greptile Summary

Fixes proxy domain validation so empty entries in the comma-separated functions-domain configuration are ignored rather than becoming catch-all restrictions.

  • Changes the loop guard to inspect the current functions-domain entry.
  • Configures the Proxy functional-test job with a trailing empty entry so existing rule-creation tests cover the regression.

Confidence Score: 5/5

The PR appears safe to merge; the focused guard correction is covered by existing end-to-end proxy rule-creation tests under the affected configuration.

No actionable correctness, security, or repository-rule violations remain. The changed guard now checks each exploded entry, while the Proxy CI configuration propagates the trailing-comma value into tests that create custom domains through the affected validation path.

Important Files Changed

Filename Overview
src/Appwrite/Platform/Modules/Proxy/Action.php Correctly skips empty _APP_DOMAIN_FUNCTIONS segments before constructing domain restrictions.
.github/workflows/ci.yml Supplies a trailing empty functions-domain segment to the Proxy functional-test environment, exercising the corrected behavior.

Reviews (4): Last reviewed commit: "test(proxy): cover empty domain entries ..." | Re-trigger Greptile

@github-actions

github-actions Bot commented Sep 8, 2026 •

Copy link
Copy Markdown

✨ Benchmark results

Comparing main (before) → fix/proxy-functions-domain-guard (after).

Metric Before After Change
🚀 Requests/sec 218.44 211.81 ⚪ -3%
⏱️ Latency P50 80.44 ms 82.33 ms ⚪ +2.4%
⏱️ Latency P95 185.88 ms 191.3 ms ⚪ +2.9%
Per-scenario breakdown & investigation details

Metrics below reflect the current branch (after). Δ P95 compares against the base.

Scenario P50 (ms) P95 (ms) Requests RPS Δ P95 (ms)
API total 82.33 191.3 13,623 211.81 +5.42
Account 164.64 292.7 717 11.87 +8.13
TablesDB 80.34 145.94 7,409 118.34 +7.26
Storage 74.59 162.24 3,585 58.68 -0.12
Functions 123.61 230.48 1,912 31.88 +4.26

Top API waits (after)

API request Max wait (ms)
account.name.update 590.17
account.prefs.update 450.42
tablesdb.rows.get 364.44
tablesdb.rows.update 353.33
functions.variables.update 345.59

HarshMN2345 and others added 3 commits September 8, 2026 16:31
PHPStan rejects assertTrue(true) as always-true. An uncaught exception still
fails the test, so expectNotToPerformAssertions states the claim directly.
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.

🐛 Bug Report: Proxy domain validation checks wrong variable in functions domain loop

2 participants