Skip to content

fix(migrations): validate source endpoints - #14034

Closed
abnegate wants to merge 22 commits into
mainfrom
fix/migration-endpoint-ssrf
Closed

abnegate wants to merge 22 commits into
mainfrom
fix/migration-endpoint-ssrf

Conversation

@abnegate

@abnegate abnegate commented Oct 1, 2026 •

Copy link
Copy Markdown
Member

What

Builds on the destination policy from #13998. main checks the Appwrite migration source endpoint only by host, against the policy that OAuth2, webhooks and avatars share, and only on report and create. The worker connects to whatever endpoint a stored migration holds, and the source's requests resolve the host again on every request and follow redirects.

Endpoint check

Appwrite\Platform\Modules\Migrations\Endpoint (resource migrationEndpoint) accepts an endpoint that:

  • is an http or https URL with no credentials, and
  • has a host that passes main's PublicHostname, or that _APP_MIGRATIONS_ALLOWED_HOSTS allows by name.

PublicHostname runs over PublicInternet plus an IPRange for each entry of _APP_ALLOWED_INTERNAL_ADDRESSES and each address or CIDR entry of _APP_MIGRATIONS_ALLOWED_HOSTS. It resolves through _APP_DNS_EXTERNAL, like publicHostname. A rejection returns general_argument_invalid with the reason.

  • GET /v1/migrations/appwrite/report and POST /v1/migrations/appwrite check endpoint with it.
  • The migrations worker checks a stored Appwrite-source endpoint again before it builds the source, so migrations queued or retried from before this change follow the same rule. The worker's own internal endpoint (http://{_APP_MIGRATION_HOST}/v1) is exempt; getInternalEndpoint() builds it in the three places that used it.

Endpoint keeps no per-call state, since one instance is shared by concurrent requests.

Source requests

The source takes a resolver from utopia-php/migration#229, which is merged on migration 3.x main. The resolver receives the URL of every Target::call() request and the endpoint of the SDK 30 client. The report route and the worker pass it Endpoint::resolve(). That checks the URL again and returns the CURLOPT_RESOLVE entry that pins the connection to the address it checked. This is main's pattern for pinning (PublicHostname::address(), as the Supabase Postgres connection uses it).

The resolver returns no entry in two cases:

  • IP literals. curl doesn't resolve them, so the connection goes to the literal that was checked.
  • Hostnames allowed by name.

A host with a trailing dot is pinned under both spellings, because curl drops the dot before it looks the host up.

While a resolver is set, the migration library also does three things:

  • it bypasses proxies, including those set in the environment;
  • it doesn't follow redirects;
  • it limits curl to http and https.

composer.json requires dev-main as 3.2.0, and the lock change covers only that package. Switch it to the release tag once migration main is tagged.

_APP_MIGRATIONS_ALLOWED_HOSTS

Takes comma-separated IP addresses, CIDR ranges and hostnames. The Appwrite source combines its entries with those of _APP_ALLOWED_INTERNAL_ADDRESSES:

  • Addresses and ranges become IPRanges on the policy. A malformed range throws, as with _APP_ALLOWED_INTERNAL_ADDRESSES.
  • _APP_ALLOWED_INTERNAL_ADDRESSES stays addresses and CIDR ranges only, as on main. A hostname there throws.
  • Hostnames match the endpoint host exactly, ignoring case and a trailing dot. appwrite allows neither appwrite.example.com nor evil-appwrite.

Supabase sources stay on publicHostname. Empty by default, which allows public sources only. The development .env sets appwrite,172.16.238.0/24, and compose passes the variable to appwrite, appwrite-worker and appwrite-worker-migrations.

PublicInternet reserved ranges

PHP's private and reserved filter flags accept two ranges they should not:

  • ::/96, the IPv4-compatible range (::7f00:1 is 127.0.0.1);
  • fec0::/10, the deprecated site-local range.

Both ranges are now in the reserved list. This affects every caller of the policy: OAuth2, webhooks, avatars, the Supabase Postgres host and migration sources.

Tests

  • Unit, PublicInternetTest: the ::/96 and fec0::/10 cases.
  • Unit, tests/unit/Platform/Modules/Migrations/EndpointTest.php covers:
    • pinning, including default and explicit ports, IPv6 brackets and trailing dots, and no pin for IP literals;
    • refusals: link-local, loopback, IPv6 loopback, a host resolving to a private address, a host that does not resolve, a lookalike of an allowed name, non-http schemes, credentials and backslashes;
    • allowed ranges and hosts allowed by name, from each variable on its own and from both at once;
    • malformed ranges in either variable;
    • a hostname in _APP_ALLOWED_INTERNAL_ADDRESSES.
  • E2E:
    • report and create refuse private, link-local, unique-local, IPv4-mapped and gopher:// endpoints;
    • the worker refuses a stored private endpoint on retry;
    • report and migrate work from http://appwrite.test/v1, which resolves into the allowed 172.16.238.0/24;
    • main's testMigrationSourceAtPrivateAddressIsRefused still passes.
  • feat: add resolver and redirect controls for source requests utopia-php/migration#229: the library's own resolver, redirect and proxy tests.

Locally, these pass on the changed files: Pint, PHPStan, Rector dry-run, EndpointTest, tests/unit/Network, and packages/client's PublicInternetTest. The E2E suite runs in CI only.

🤖 Generated with Claude Code

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Your trial has ended. Reactivate Greptile to resume code reviews.

@ghost

ghost commented Oct 1, 2026 •

Copy link
Copy Markdown

🟢 Tier S · Ready to merge

The 3.2.0 tag resolves to the same commit previously locked from main, so this follow-up changes dependency stability metadata without changing the package code.

Adds migration-specific validation for Appwrite source endpoints, including host/address allowlists, DNS pinning, and worker-side revalidation; the shared public-internet policy also rejects two reserved IPv6 ranges. The final dependency update switches the migration library from its development branch alias to the 3.2 release constraint and tag.

Latest changes: The latest commits replace the dev-main as 3.2.0 alias with ^3.2 and lock the published 3.2.0 tag.

Verdict New comments Fixed Still open
✅ Approved 0 0 0
📂 Walkthrough · 15
File Change
.env Allows the local Appwrite hostname and development subnet for migration sources.
app/config/variables.php Documents the migration-specific endpoint allowance variable.
app/init/resources.php Registers a shared migration endpoint validator with the configured DNS and address allowances.
composer.json Requires the published migration library using the ^3.2 constraint.
composer.lock Locks utopia-php/migration to the published 3.2.0 tag.
docker-compose.yml Passes the migration allowed-hosts setting into the Appwrite services and workers.
packages/client/CHANGELOG.md Documents the newly rejected IPv6 reserved ranges.
packages/client/src/Destinations/PublicInternet.php Adds IPv4-compatible and deprecated site-local IPv6 ranges to the reserved-address policy.
packages/client/tests/Destinations/PublicInternetTest.php Covers rejection of the newly reserved IPv6 ranges.
src/Appwrite/Platform/Modules/Migrations/Endpoint.php Validates migration source URLs and produces DNS pin entries for allowed hostnames.
src/Appwrite/Platform/Modules/Migrations/Http/Migrations/Appwrite/Create.php Validates Appwrite source endpoints before migration creation.
src/Appwrite/Platform/Modules/Migrations/Http/Migrations/Appwrite/Report/Get.php Validates report endpoints and passes the resolver to the Appwrite source.
src/Appwrite/Platform/Workers/Migrations.php Revalidates stored Appwrite source endpoints when processing queued migrations.
tests/e2e/Services/Migrations/MigrationsBase.php Adds endpoint rejection, worker revalidation, and allowed internal-source migration coverage.
tests/unit/Platform/Modules/Migrations/EndpointTest.php Tests migration endpoint validation, hostname and CIDR allowances, and DNS pin generation.

Reviewed the commits since 460e021 · Details · Comment @hansi-codes review to re-run, or mention @hansi-codes with a question.

ghost
ghost previously requested changes Oct 1, 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 D · 1 blocking finding to address. Summary

Comment thread src/Appwrite/Network/Subnet.php Resolved
@github-actions

github-actions Bot commented Oct 1, 2026 •

Copy link
Copy Markdown

✨ Benchmark results

Comparing main (before) → fix/migration-endpoint-ssrf (after).

Metric Before After Change
🚀 Requests/sec 188.32 190.75 ⚪ +1.3%
⏱️ Latency P50 90.93 ms 91.15 ms ⚪ +0.2%
⏱️ Latency P95 216.62 ms 207.75 ms ⚪ -4.1%
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 91.15 207.75 12,084 190.75 -8.86
Account 173.68 302.93 636 10.58 -28.58
TablesDB 88.14 168.81 6,572 106.65 -4.81
Storage 83.43 189.62 3,180 53.34 +3.18
Functions 124.71 231.42 1,696 29.3 -35

Top API waits (after)

API request Max wait (ms)
functions.create 437.72
storage.buckets.create 432.29
account.name.update 430.52
account.prefs.update 380.3
functions.variables.update 337.79

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Your trial has ended. Reactivate Greptile to resume code reviews.

abnegate and others added 2 commits October 1, 2026 17:37
Some callers need to reach destinations that are deliberately private,
such as another service on the same network, while still refusing every
other private or reserved address. PublicHostname and PublicURL now take
an optional Allowlist of exact hostnames and IPv4/IPv6 subnets. A listed
hostname is accepted without a lookup, an IP in a listed subnet is
accepted, and a hostname is accepted when every address it resolves to
is public or listed. Hostnames never match by suffix, and numeric
spellings such as 2130706433 or 127.1 are never treated as listed
hostnames.

The allowlist defaults to empty, so existing callers keep their current
behaviour.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The Appwrite migration report and create endpoints accepted any URL for
the source endpoint, so the server could be pointed at loopback, private,
link-local or other reserved addresses, and the migrations worker used
whatever endpoint had been stored. Both params now use an Endpoint
validator built on PublicURL: http or https only, a known public domain
or public IP, and every resolved address public. The worker validates a
stored endpoint again before it builds the source, so migrations queued
earlier or retried are held to the same rule; the internal endpoint the
worker writes itself is exempt.

PublicHostname now also treats IPv4-compatible IPv6 addresses (::/96,
e.g. ::7f00:1) and the deprecated site-local range (fec0::/10) as
reserved, and PublicURL refuses URLs with userinfo or backslashes, where
URL parsers and curl can disagree on the host. The Endpoint validator
reports one fixed description, so a rejection does not reveal whether a
host exists or what it resolves to.

_APP_MIGRATIONS_ALLOWED_HOSTS takes comma-separated hostnames and IPv4 or
IPv6 CIDR ranges for sources that are deliberately private, such as an
instance on the same network. Hostnames match exactly. It is empty by
default, which allows public sources only; the development .env lists
appwrite and appwrite.test so the local stack can migrate from itself.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@abnegate
abnegate force-pushed the fix/migration-endpoint-ssrf branch from fb1f75a to 576790f Compare October 1, 2026 04:39

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Your trial has ended. Reactivate Greptile to resume code reviews.

abnegate and others added 5 commits October 1, 2026 22:31
…hp/validators

Subnet and Allowlist are generic network primitives, so they belong in the
validators package rather than src/Appwrite. Both are now Utopia validators:
Subnet matches an address against one CIDR range or single address, and
Allowlist matches exact hostnames or addresses inside its subnets.

Reading _APP_MIGRATIONS_ALLOWED_HOSTS stays in the migrations Endpoint, since
the comma-separated format and the rule that unparsable entries are ignored
are Appwrite configuration policy. PublicURL now only asks whether a resolved
address is listed; the per-address public-or-listed rule is enforced once, by
the PublicHostname check that already follows it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Worker behaviour is covered by e2e tests, not worker unit tests. The create
route now refuses private endpoints, so the e2e test stores an Appwrite
migration directly, the way a job created before validation would look,
retries it through the API and checks that the real worker records the
endpoint failure.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ated addresses

The endpoint was validated once, and then the Appwrite source resolved the
host again for every request it sent and followed redirects, so the
checked addresses were not necessarily the ones it connected to.

Apply the 2.0.x and 1.9.x change here. Endpoint::resolve() validates a
request URL and returns the CURLOPT_RESOLVE entries for the addresses it
checked. The report route and the worker pass it to the Appwrite source
through setResolver(), so every source request is validated again and
connects only to those addresses. The worker skips its own internal
_APP_MIGRATION_HOST endpoint, which now comes from one helper shared with
processMigration() and authenticateSource().

setResolver() comes from utopia-php/migration#230, the backport cut from
2.0.8, the version main locks today. It overrides the SDK 27 client's
call(). utopia-php/migration#229, the main-line change, builds on Appwrite
SDK 30, which imports Utopia\Client; this repository's packages/client
only provides Utopia\Client\Client, so that change cannot load here yet.
The requirement points at the backport branch until 2.0.9 is tagged, and
the lock change covers only that package.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
PublicHostname::resolve() uses Swoole\Coroutine\System::getaddrinfo()
inside any coroutine, to avoid the ~140 KiB that Swoole 6.2 keeps for each
hooked dns_get_record() call. getaddrinfo() always yields, even when the
runtime hooks nothing, and a caller that waits for it in an unhooked
usleep() loop never lets the reactor resume it.

The 1.9.x and 2.0.x backports of this PR hit exactly that: their HTTP
servers set no hook_flags, GraphQL's Promise::then() waits in a usleep()
loop, and every GraphQL avatar request that fetches a URL hung.

The retained memory only comes from the SWOOLE_HOOK_NET_FUNCTION hook, so
resolve natively only when that hook is active, and otherwise make the
blocking dns_get_record() call, which neither yields nor retains memory
without the hook. Main's HTTP server and the workers enable
SWOOLE_HOOK_ALL, so they keep the native lookup; this keeps the three
lines identical. The regression test resolves inside a child of an
unhooked coroutine and fails if control returns to the parent before the
lookup finishes.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
… to end

Every Appwrite migration test used appwrite.test, which the allowlist
admits by name without resolving it, so no E2E request went through the
resolved and pinned path.

List the compose network (172.16.238.0/24) in the development allowlist
and report and migrate from http://traefik/v1. traefik is not a listed
hostname, so the validator resolves it, admits the address because it is
inside the listed range, and the source connects to that address through
the CURLOPT_RESOLVE entry. Each test uses its own source project so the
user counts stay exact while other migration tests run in parallel.

Also report from the allowlisted appwrite.test, as 1.9.x already does, and
reject http://localhost/v1, a hostname that resolves outside every listed
range.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

@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 A · Looks good to merge. Summary

abnegate and others added 2 commits October 2, 2026 16:20
composer.lock: kept main's lock and re-applied only the utopia-php/migration backport branch with composer update.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
AGENTS.md allows no new regular expressions. Split the CURLOPT_RESOLVE entry on its separators, compare the host and port exactly, and check every address with the Subnet validator for 127.0.0.0/8 or ::1.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

@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

abnegate and others added 3 commits October 2, 2026 16:24
CI enables _APP_OPTIONS_ROUTER_PROTECTION, so requests to http://traefik/v1 reached the API through the pinned address and were refused with 401 because traefik is not a platform hostname.

Stop listing appwrite.test by name in the development allowlist instead. It is _APP_DOMAIN, so the router accepts it, and the validator now resolves it to traefik's address inside the listed 172.16.238.0/24 range. The subnet tests use it, and every other Appwrite migration E2E test now takes the resolved and pinned path too.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ion policy

The Appwrite source endpoint was checked only by host, against the
policy shared with OAuth2, webhooks and avatars, and only when the
migration was created or reported. The migrations worker connected to
whatever endpoint the stored migration held, and the source's own curl
requests, outside Utopia\Client, resolved the host again on every request
and followed redirects anywhere.

A migrations Endpoint now accepts an http or https URL without
credentials whose host passes PublicHostname over PublicInternet plus the
IPRange entries of _APP_MIGRATIONS_ALLOWED_HOSTS, resolving through
_APP_DNS_EXTERNAL, or is a hostname that list allows by name. The report
and create routes check the endpoint with it, and the worker checks a
stored endpoint again before building the source, so migrations queued
or retried from before this change follow the same rule. Its own internal
endpoint (http://{_APP_MIGRATION_HOST}/v1) is exempt.

The source cannot take a Utopia\Client: utopia-php/migration 2.0.x is on
Appwrite PHP SDK 27, which drives curl itself. Its resolver hook
(utopia-php/migration#230) receives every request URL, so the report
route and the worker pass Endpoint::resolve(), which checks the URL and
pins the connection to the address it checked through CURLOPT_RESOLVE.
#230 also stops following redirects, restricts curl to http and https,
and now ignores proxies while a resolver is set. composer.json requires
its branch as 2.0.9 until that release is tagged.

Appwrite migration sources use _APP_MIGRATIONS_ALLOWED_HOSTS in place of
_APP_ALLOWED_INTERNAL_ADDRESSES; the development .env lists appwrite and
the compose network so the local stack can migrate from itself.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Replaces the branch's earlier validator changes with the rebuild on main.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
ghost
ghost previously requested changes Oct 2, 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 D · 1 blocking finding to address. Summary

PHP's private and reserved range flags accept ::/96 (IPv4-compatible,
::7f00:1 being 127.0.0.1) and fec0::/10 (deprecated site-local), so
PublicInternet allowed fec0::1 and ::7f00:1 without an explicit range.
Both now sit in its reserved list; ::/96 also covers the unspecified
address that ::/128 listed.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

@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

…sources

On main the Appwrite source endpoint went through publicHostname, which
admits _APP_ALLOWED_INTERNAL_ADDRESSES, so a self-hosted instance that
listed its internal source there would have been refused once the source
moved to _APP_MIGRATIONS_ALLOWED_HOSTS alone. Endpoint now takes both
lists and parses them itself under the same rules: an address or CIDR
range becomes an IPRange on the policy, anything else is a hostname
allowed by name, and a malformed range throws.

The development .env lists loopback in _APP_ALLOWED_INTERNAL_ADDRESSES,
so the E2E rejection and retry tests use a private IPv4, a unique-local
IPv6 and an IPv4-mapped loopback address instead of loopback.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

@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 A · Looks good to merge. Summary

Comment thread app/init/resources.php Resolved
Endpoint read both allowlists under one rule, so a hostname in
_APP_ALLOWED_INTERNAL_ADDRESSES passed report and create. The migrations
worker also injects publicHostname, whose factory turns every entry of
that variable into an IPRange and throws on a hostname, so the accepted
migration could never run. Endpoint now applies main's rule to that
variable: every entry is an address or CIDR range, and anything else
throws, as it does in publicHostname and the clientFor* factories. Only
_APP_MIGRATIONS_ALLOWED_HOSTS takes hostnames, so every configuration
Endpoint accepts is one the worker's other dependencies accept too.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

@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

Keeps main's utopia-php/database ^7.4.1 and its removal of
_APP_ASSISTANT_OPENAI_API_KEY; re-applies only the utopia-php/migration
dev branch pin and _APP_MIGRATIONS_ALLOWED_HOSTS.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@github-actions

github-actions Bot commented Oct 8, 2026 •

Copy link
Copy Markdown

Security rules

No new WARNING or ERROR findings from security rules.

19 existing findings tracked in .semgrep/baseline.json
  • php.appwrite.guest-write-without-abuse-limit (12)
  • php.appwrite.secret-compare-timing (5)
  • php.appwrite.weak-secret-env-default (2)

Posted by Checks / Rules. Re-runs update this comment in place. Rule details and baseline: .semgrep/README.md.

Main moved to utopia-php/migration 3.x, whose source requests go through
utopia-php/client, so the 2.0.x resolver branch no longer applies. Require
utopia-php/migration#240 instead, which passes a Destinations policy through.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
utopia-php/migration 3.x sends every source request through
utopia-php/client, which checks each connection and redirect hop against
the address it actually reached. Hand the source the endpoint's policy
instead of CURLOPT_RESOLVE pins: rebinding and redirects are refused on
the connected address, and redirects no longer need to be disabled to
stay safe. A host allowed by name in _APP_MIGRATIONS_ALLOWED_HOSTS is
trusted by the operator and may connect anywhere.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@abnegate

Copy link
Copy Markdown
Member Author

Merged main in. Main now requires utopia-php/migration ^3.1.2, so the 2.0.x resolver branch (utopia-php/migration#230) no longer applies, and I reworked the source side to match.

  • Source requests: 3.x sends every source request through utopia-php/client: Target::call() and the SDK 30 client. That client already checks each connection and redirect hop against the address it actually reached, and refuses proxies. feat: confine source requests to a destinations policy utopia-php/migration#240 adds Target::setDestinations() and passes the policy on to the SDK client. Here, Endpoint::resolve() (the CURLOPT_RESOLVE pins) becomes Endpoint::destinations(). The report route and the worker call setDestinations() with it. composer.json requires dev-feat/source-destinations as 3.2.0 until Fixed Typo in CONTRIBUTING md File #240 is tagged.
  • Hosts allowed by name: they get Anywhere. External DNS usually cannot resolve them, and the operator has explicitly trusted them. Please look at this tradeoff in particular: a redirect from such a host is followed without an address check.
  • E2E fixture: MigrationsBase::createMigrationFixture now uses main's databaseFactory register entry and the Utopia\Database\Id and Utopia\Console namespaces.
  • _APP_MIGRATIONS_ALLOWED_HOSTS: introduction set to 2.5.1, since main's stable version is now 2.5.0.

Commits: 94c8f78 (merge) and 7c531eb (destinations).

ghost
ghost previously requested changes Oct 15, 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

Comment thread composer.lock Resolved
@ghost
ghost dismissed stale reviews from themself October 15, 2026 03:59

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

@abnegate

Copy link
Copy Markdown
Member Author

@hansi-codes review

@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

…lver

utopia-php/migration#229 landed the source resolver and redirect controls
on 3.x main, so the source takes CURLOPT_RESOLVE pins from Endpoint again
instead of a destinations policy from a separate branch. Require migration
main until it is tagged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@abnegate

Copy link
Copy Markdown
Member Author

Update: utopia-php/migration#229 merged into migration 3.x main while CI was running. It carries the source resolver and redirect controls this PR was built on. So 460e021 goes back to the reviewed Endpoint::resolve() pinning, and the destinations rework from 7c531eb is dropped.

abnegate and others added 3 commits October 15, 2026 18:52
3.2.0 is the first tag carrying the source request resolver from
utopia-php/migration#229, so the dev-main alias is no longer needed.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
# Conflicts:
#	composer.json
#	composer.lock
@abnegate

Copy link
Copy Markdown
Member Author

Closing as obsolete. On main, the source endpoint is already checked when a migration is created (PublicHostname, 965d7e8). The absorbed packages/migration also refuses redirects and allows only http/https on source requests. The 1.9.x backport landed in #14036, and #14035 covers 2.0.x.

@abnegate abnegate closed this Oct 15, 2026
imtia33 pushed a commit to imtia33/appwrite that referenced this pull request Oct 15, 2026
Ports utopia-php/migration#240. Target::setDestinations() hands a
Utopia\Client\Destinations to the client Target::call() builds, and the
Appwrite source applies it to its SDK client as well. utopia-php/client
checks every connection and redirect hop against the address curl
actually reached, and refuses proxies under a restricting policy, so a
host that rebinds or redirects cannot reach an address the caller did
not admit. Unset, requests connect anywhere, as before.

The resolver controls from appwrite#229 stay: appwrite#14034 uses
setResolver() today, and the two compose. The changelog gains a 4.0.0
section for this and for what landed since 3.1.2 without an entry,
including the redirect default that makes it a major.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
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