mirror of
https://gitee.com/mateos/mateclaw.git
synced 2026-09-13 03:13:41 +08:00
The first cut of the per-request interceptor called route.resume() for every request. Playwright follows server-side 3xx redirects internally on resume() WITHOUT re-invoking the route handler, so a public page that 302s to a metadata IP still reached it — verified via runtime E2E (the handler only ever saw the httpbin.org URLs, never the 169.254.169.254 redirect target). Fix: for navigation requests, fetch with maxRedirects=0 and validate the Location of each hop through UrlSafetyChecker before fulfilling; abort when a hop resolves to a blocked host. Subresources/fetches keep the direct per-URL check + resume path. Non-navigation and non-http(s) requests are unaffected. Runtime-verified: httpbin.org 302 -> 169.254.169.254 is now aborted (net::ERR_FAILED; log "blocked redirect ... cloud-metadata endpoint"), while example.com and wikipedia.org (rich subresources) still load with no false blocks. |
||
|---|---|---|
| .. | ||
| src | ||
| Dockerfile | ||
| pom.xml | ||
| settings.xml | ||