Skip to content

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

Closed

Description

@zaidxshaikh

Description

In src/Appwrite/Platform/Modules/Proxy/Action.php, the validateDomainRestrictions() method has a bug on line 53. The empty() check inside the foreach loop checks the outer variable $functionsDomains (plural) instead of the loop variable $functionsDomain (singular).

Reproduction

// Current code (line 51-55):
$functionsDomains = System::getEnv('_APP_DOMAIN_FUNCTIONS', '');
foreach (\explode(',', $functionsDomains) as $functionsDomain) {
    if (empty($functionsDomains)) {  // BUG: checks outer variable
        continue;
    }
    // ...
}

The same pattern on line 39-41 for $sitesDomains is correct:

foreach (\explode(',', $sitesDomains) as $sitesDomain) {
    if (empty($sitesDomain)) {  // Correct: checks loop variable
        continue;
    }
}

Expected Behavior

The loop should check empty($functionsDomain) (singular) to skip empty entries from the comma-separated string, consistent with the sites domain loop above it.

Impact

  • If _APP_DOMAIN_FUNCTIONS is set (non-empty), the empty() check never triggers, meaning empty entries from trailing commas or double commas get processed as domain restrictions
  • Domain restriction validation for functions domains may not work correctly

Fix

- if (empty($functionsDomains)) {
+ if (empty($functionsDomain)) {

Single character fix: $functionsDomains → $functionsDomain

Environment

  • Appwrite version: 1.9.x branch (latest)
  • File: src/Appwrite/Platform/Modules/Proxy/Action.php:53

Activity

  1. zaidxshaikh commented on Mar 30, 2026

    @zaidxshaikh
    Author

    I'd like to work on this. I've already identified the fix - it's a single character change from \ to \ on line 53.

  2. added
    product / domains
    product / functions
    product / sites
    on Mar 30, 2026
  3. added a commit that references this issue on Mar 30, 2026
    90b2563
  4. bellahadid27211-lab commented on Mar 30, 2026

    @bellahadid27211-lab
  5. added a commit that references this issue on Mar 31, 2026
    3bb2c34
  6. zaidxshaikh commented on Mar 31, 2026

    @zaidxshaikh
    Author

    @bellahadid27211-lab Thanks! PR is already open: #11676

  7. HarshMN2345 commented on Sep 8, 2026

    @HarshMN2345
    Member

    fixed in #13529

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    product / domainsproduct / functionsproduct / sites

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions