Repository navigation
fix(web)!: scope headers and basicAuth to the app's origin - #1393
Conversation
🟢 e2e web agent: 33 passed34 agent steps · 26 replayed from cache · 20 model calls · 88.3k tokens (94% cached) · $0.0034 All 33 tests in 5 files
Tested by e2e 0.23.0 · 1m 28s · web · run artifacts |
🟢 e2e web: 91 passedAll 91 tests in 41 files
Tested by e2e 0.23.0 · 1m 18s · web · run artifacts |
🟢 e2e ios agent: 21 passed, 1 skipped25 agent steps · 12 replayed from cache · 56 model calls · 343.6k tokens (82% cached) · $0.0236 All 22 tests in 1 file
Tested by e2e 0.23.0 · 8m 19s · ios-simulator · run artifacts |
🟢 e2e ios: 55 passed, 1 skippedAll 56 tests in 7 files
Tested by e2e 0.23.0 · 7m 2s · ios-simulator · run artifacts |
🟢 e2e android agent: 1 flaky, 19 passed24 agent steps · 15 replayed from cache · 36 model calls · 330.6k tokens (79% cached) · $0.0250
|
| Test | Agent | Time | |
|---|---|---|---|
| tests-agent/scenarios.e2e.ts · 1 flaky, 19 passed | 24 steps · 36 calls | 6m 30s | |
| 🟢 | act completes Login Form | 1 step | 26.4s |
| 🟢 | act completes Infinite Scroll List | 1 step | 26.1s |
| 🟢 | act completes Modal Flow | 1 step | 12.6s |
| 🟢 | act completes Bottom Tabs | 1 step | 8.6s |
| 🟢 | act completes Text Input Variations | 1 step | 10.5s |
| 🟢 | act completes Broken Accessibility | 2 steps · 5 calls | 16.0s |
| 🟢 | act completes Vision Only | 2 steps · 1 call | 6.9s |
| 🟢 | act completes Gestures | 1 step · 7 calls | 20.4s |
| act completes Async States (1 failed attempt first) | 1 step · 9 calls | 21.8s | |
| 🟢 | act completes Debounced Search | 1 step | 7.1s |
| 🟢 | act completes Huge Virtualized List | 1 step | 1m 57s |
| 🟢 | act completes Flattened Registration Form | 2 steps · 1 call | 11.4s |
| 🟢 | act completes Flattened Login | 2 steps · 8 calls | 27.4s |
| 🟢 | act completes Sticky Chrome Target | 1 step | 10.7s |
| 🟢 | act completes WebView Accessibility | 1 step · 5 calls | 18.1s |
| 🟢 | act completes Permission Prompt | 1 step | 8.3s |
| 🟢 | act completes Product Catalog | 1 step | 9.8s |
| 🟢 | act completes Error Recovery | 1 step | 10.0s |
| 🟢 | act completes Choice Controls | 1 step | 9.6s |
| 🟢 | act completes Sequential Onboarding | 1 step | 10.9s |
Tested by e2e 0.23.0 · 7m 22s · android-emulator · run artifacts
🟢 e2e android: 57 passed, 1 skippedAll 58 tests in 7 files
Tested by e2e 0.23.0 · 9m 25s · android-emulator · run artifacts |
12dca1f to
5cccbf0
Compare
okwasniewski
left a comment
There was a problem hiding this comment.
Ran the suites, a can-fail pass against the merge base, and a real CLI repro. The leak fix is right. On the base build another port on the same host gets x-gate and answers basic auth. On this branch it gets neither, and listing it in headerOrigins / basicAuth.origins brings it back, on the real port for a port-0 app.url. The new tests fail on the base, so they pin the fix. engineAppInfo() is the only builder, so every path passes origin.
Holding it for one regression and a merge-order issue.
Blocker. WebKit basic auth breaks on 443/80 and IPv6 hosts. Details inline on protected-app.ts.
Merge order vs #1590. Inline on package.json.
Should-fix
- Wildcard and port-0 origins pass validation and match nothing (inline).
SECURITY.md:79-81still says the browser engine'sheadersreach the site and no other host. It isn't in the diff, so noting it here.- The
headersJSDoc anddocs/reference/web.mdxsay other origins never get them, which contradicts the redirect behavior documented elsewhere (inline). - The
routes.test.tscross-origin case can't fail (inline).
Decision. headerOrigins sits beside headers while basicAuth.origins is nested. I get why, since an origins key inside the headers record would collide with a header name. Still, this breaking minor is the cheap moment to settle the shape, so worth a deliberate call.
Nits
docs/migrate/playwright.mdx: theextraHTTPHeadersrow doesn't mentionheaderOrigins, and that's the row most likely to break a migrating suite.docs/security.mdxsaysbasicAuthgoes on every request. It only answers a challenge.e2e doctorpassesoriginwith:0for a port-0 app (doctor.ts:205never assigns ports), against the new JSDoc that says "on the run's port".- "origin headers" in
writing-tests.mdandbrowser.tsreads like the HTTPOriginheader.route-options.ts:29still says "the site's".
| }, | ||
| "peerDependencies": { | ||
| "e2e": ">=0.22.1 <1" | ||
| "e2e": ">=0.23.1 <1" |
There was a problem hiding this comment.
#1590 already proposes e2e 0.23.1 from the three patch changesets on main, without this PR's origin change. If it merges first, the runner side of this PR ships as 0.23.2, but web 0.16.0 still accepts 0.23.1. Headers and basicAuth users on 0.23.1 then hit "needs e2e 0.23.1 or later" in init while running 0.23.1. onlyUpdatePeerDependentsWhenOutOfRange won't move the range.
Either land this before #1590, or bump the floor, the guard message in surface.ts and the changeset to 0.23.2.
There was a problem hiding this comment.
[claude-opus-5-5] responding on behalf of KrzysztofMoch
d875e67 takes the version out of the init guard message and the changeset. It now says to update e2e to the release that ships with this @e2e-dev/web. The floor stays >=0.23.1. If this lands first, 0.23.1 is the release that carries origin, and a 0.23.2 floor would leave @e2e-dev/web with no runner that satisfies it. If #1590 lands first, I'll raise the floor to 0.23.2 when I rebase. Leaving this open, since the merge order isn't mine to pick.
5cccbf0 to
7049646
Compare
|
[claude-opus-5-5] responding on behalf of KrzysztofMoch The review-level items, all in d875e67 and 7049646:
The PR body has the updated CLI table and the WebKit run. |
headers went to every host on the app's site and basicAuth answered a 401 from any origin. Both now go to the app's exact origin, with headerOrigins and basicAuth.origins for extras. The runner passes the origin to engines as EngineAppInfo.origin.
…t ports headerOrigins and basicAuth.origins become one credentialOrigins option that covers both. WebKit never matches a scoped credential to an origin on a default port or with an IPv6 host, so there basic auth goes unscoped, as Playwright's default. A wildcard host or port 0 in the list is INVALID_CONFIG, since it would match nothing. e2e doctor leaves the origin out until a free port is assigned. Docs no longer claim headers skip other origins: a redirect keeps them.
7049646 to
4ad8d7b
Compare
The rebase onto 046bd08 dropped the web package.json bump, since e2e-inc#1393 already raised web's e2e peer floor to >=0.23.1 on main. The changeset still listed @e2e-dev/web as patch and described a web floor raise, which would have shipped a wrong CHANGELOG line and an extra web release. Drop web from the frontmatter and the bullet; mobile, acp, and limrun are unchanged. Signed-off-by: Varshith Puli <pulivarshit@gmail.com>
The rebase onto 046bd08 dropped the web package.json bump, since e2e-inc#1393 already raised web's e2e peer floor to >=0.23.1 on main. The changeset still listed @e2e-dev/web as patch and described a web floor raise, which would have shipped a wrong CHANGELOG line and an extra web release. Drop web from the frontmatter and the bullet; mobile, acp, and limrun are unchanged. Signed-off-by: Varshith Puli <pulivarshit@gmail.com>
The rebase onto 046bd08 dropped the web package.json bump, since e2e-inc#1393 already raised web's e2e peer floor to >=0.23.1 on main. The changeset still listed @e2e-dev/web as patch and described a web floor raise, which would have shipped a wrong CHANGELOG line and an extra web release. Drop web from the frontmatter and the bullet; mobile, acp, and limrun are unchanged. Signed-off-by: Varshith Puli <pulivarshit@gmail.com>
web({ basicAuth })answered a401from any origin, andweb({ headers })went to every host on the app's site: another port on the same host, sibling subdomains, every host under a shared domain such asvercel.app. A third-party origin the app embeds could collect a preview password or ax-vercel-protection-bypasstoken. Fixes ENG-846.What changed
app.url.credentialOrigins, lists extra origins for both. Each entry must be an exacthttp:/https:origin, elseINVALID_CONFIGat config load. That includes a*in the host and port0, which would match nothing.basicAuthbecomes Playwright's per-originhttpCredentialsarray, one entry per allowed origin (packages/web/src/protected-app.ts).EngineAppInfo.origintoprepareandinit(packages/e2e/src/config/app.ts). It carries the run's real port whenapp.urluses port0, and is left out until that port is assigned (e2e doctor).@e2e-dev/webraises itse2epeer floor to>=0.23.1. On an older runner,initfails withINVALID_CONFIGinstead of sending credentials nowhere. If chore: version packages #1590 releases 0.23.1 first, the floor moves to 0.23.2 when I rebase.browser.route'sroute.continue()androute.fetch()add the configured headers under the same origin rule.@e2e-dev/web(minor,**Breaking:**). The changeset carries the migration note.Not changed: a header Playwright injects into a request stays on that request's redirects, to any origin. Playwright reapplies a routed request's headers to every redirect hop without routing the hop (
crNetworkManager,_alreadyContinuedParams). This was already true on main. The docs now say so, and a test pins it. Closing it means fetching outside the browser withroute.fetch({ maxRedirects: 0 }), which costs the HTTP cache and streaming, so it's out of scope here.Verified
Ran it locally: yes
credentialOriginson/ Protectedon/ Protectedon/ Protectedon(the bug)noneoncredentialOrigins: ['https://*.vercel.app']and['http://127.0.0.1:0']at load withINVALID_CONFIG, naming the entry.[::1]protected-app.test.tssends a request to another port on the same host and to a third-party site, for bothheadersandbasicAuth, with and without the extra origin, plus redirects in both directions.routes.test.tscoverscontinue({ url })androute.fetch()to another port on the same host and to a listed one. Both new route tests fail against main's engine source.401withERR_INVALID_AUTH_CREDENTIALSrather than rendering the page. Main does the same for any unanswered401, but now more origins go unanswered.pnpm checkandpnpm testpass.Opus 5.5 in Claude Code (T3 Code). Reviewed by Fable 5.1.