fix(providers): admit credential endpoints and bound responses
Merged
TH
2h ago+604+604+012345678901234567890123456789-72-72-01234567890123456789
Summary
BrowserStack/TestMu requests that carry credentials go only to HTTPS or loopback-HTTP endpoints and never follow redirects. Every provider response body (WebDriver hub, Revyl, Limrun) is read through one bounded reader. The endpoint URL comes from user config or profile; the response bytes come from the provider.
Before / after
- Before: credentials could be sent over cleartext public HTTP, a redirect could carry them to another host, and
response.text()/arrayBuffer()/json()read unbounded provider bodies. - After: the
credentialTransportRefusalrule (throughadmitCredentialDestination, including theAGENT_DEVICE_ALLOW_INSECURE_TRANSPORToverride) is checked with the hostenvbefore each credentialed request. Credentialed requests useredirect: 'manual', and any 3xx givesprovider_redirect_refused. Requests without credentials keep following redirects. @agent-device/host-kit/response-bodyreads bodies with a 1 MiB budget. Successful screenshot and source answers, Revyl artifact answers, and provider catalog or app-list replies get 32 MiB. Overflow givesprovider_response_too_largewith the HTTP status. An oversized Revyl error body is dropped, so the status classifier still runs.- Limrun's file download keeps
createByteLimitStream(2 GiB cap). Info.plist and release manifest reads pass a 256 KiB budget. - The host-kit readers load on demand, so the eager module closures stay within budget.
Out of scope: long-lived streaming bodies, such as the Limrun /xctest/run success stream.
Size
About 260 production lines versus 0.22.
Validation
Ran the provider package suites, packages/host-kit/src/response-body.test.ts, and scripts/__tests__/eager-closure-budgets.test.ts with vitest. All passed.