Repository navigation
feat(migration): confine source requests to a destinations policy - #14508
Conversation
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 #229 stay: #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]>
|
Review complete. No issues found — approved ✅. The change introduces destination-based network confinement for data migrations, ensuring outbound HTTP connections (including redirect hops) are validated against configured destinations.
Reviewed commit: b1de3c2 |
🟢 Tier S · Ready to merge
Adds a destinations policy to migration targets and forwards the same policy from Appwrite sources to their SDK client. Adds coverage for policy refusal, allowed loopback access, and applying the policy after a request; updates the migration changelog.
📂 Walkthrough · 6
Reviewed |
Security rulesNo new WARNING or ERROR findings from security rules. 19 existing findings tracked in
|
✨ Benchmark resultsComparing
Per-scenario breakdown & investigation detailsMetrics below reflect the current branch (after). Δ P95 compares against the base.
Top API waits (after)
|
What
This ports utopia-php/migration#240 now that migration lives in
packages/migration(#14503).Target::setDestinations(Destinations)confines a target's requests to aUtopia\Client\Destinationspolicy. The Appwrite source applies the same policy to its SDK client,Sources\Appwrite\Client.If no policy is set, nothing changes: requests can connect anywhere, as before.
Why
#14034 checks a migration source's endpoint before it connects. utopia-php/client goes further: it checks every connection, and every redirect hop, against the address curl actually connected to, and refuses proxies when the policy restricts addresses. So the library only needs to pass the caller's policy through.
Differences from #240
setResolver()today, so it stays. The two work together:setDestinations()first. That's left for a follow-up.RequestTargetthat [bug] Empty modal after wrong input #229 added, instead of Fixed Typo in CONTRIBUTING md File #240's own server script.CHANGELOG.mdgains a4.0.0 (unreleased)section covering this PR and what landed since 3.1.2 without an entry. That includes [bug] Empty modal after wrong input #229's change to stop following redirects by default, which is breaking and is why the section is a major version.Tests
tests/General/TargetDestinationsTest.phpcovers seven cases:PublicInternetrefusing it, without the server seeing a request;PublicInternetwith a127.0.0.0/8range admitting it;127.0.0.0/8range;Six of the seven fail without the change. The no-policy case passes either way.
Locally:
bin/monorepo check migrationpasses (Rector, Pint, PHPStan level max).Not verified
🤖 Generated with Claude Code