feat(config)!: drop origin allowlists everywhere; navigation and secret fills are not gated by origin

Merged
OK
2mo ago
+351-521

What and why

  • Origin allowlists are gone, everywhere. playwright({ allowedOrigins }) gated typed navigation only; a click, a redirect, or a popup reached any origin regardless, so the list guarded nothing and had to be spelled out for every subdomain a sign-in flow touched.
  • The per-credential and per-secret allowedOrigins went with it. A secret is only ever typed into a field the step was handed, and a password only into a password field, so an origin gate on the fill guarded against a model mistake at the cost of configuring every flow that leaves the app's domain, a Google sign-in included. If a threat model ever calls for it, it comes back as an opt-in.
  • app.open(), the agent's navigate, web.goto, and cookie targets open any http(s) URL. file:, data:, and javascript: stay POLICY_DENIED (packages/e2e/src/internal/urls.ts).
  • credentials entries are { username, password }. secrets entries are a string or a provider; the { value } object form only existed to carry the list and is gone too. type_secret now works on a device target, which the origin check used to block.
  • The site of url, its registrable domain, survives where it is invisible to config: the browser engine's headers reach the site and no other host, and off-site iframes stay out of observations. basicAuth answers any 401, as Playwright's own httpCredentials does.
  • Engine contract: EngineAppInfo.allowedOrigins became site?: string, EngineAppDeclaration lost the field, sameSite and siteOf are exported from @e2edev/e2e/engine. playwright({ allowedOrigins }) fails at config load.
  • SECURITY.md claimed link-local and cloud-metadata denies that never existed in code; the sentence is removed rather than the check invented.
flowchart LR
  subgraph before
    N1[navigate / open] --> A1{origin in allowedOrigins?}
    C1[click / redirect / popup] --> X1[any origin]
    S1[secret fill] --> A2{origin in allowedOrigins ∩ credential list?} --> A3{declared in step? editable? password field?}
  end
  subgraph after
    N2[navigate / open] --> B1{http or https?}
    C2[click / redirect / popup] --> X2[any origin]
    S2[secret fill] --> B3{declared in step? editable? password field?}
  end
// before
engine: playwright({
  url: 'https://tester.army',
  allowedOrigins: ['https://tester.army', 'https://www.tester.army', 'https://auth.tester.army'],
}),
credentials: {
  google: { username: 'tester@gmail.com', password: process.env.GOOGLE_PASSWORD ?? '', allowedOrigins: ['https://accounts.google.com'] },
},

// after
engine: playwright({ url: 'https://tester.army' }),
credentials: {
  google: { username: 'tester@gmail.com', password: process.env.GOOGLE_PASSWORD ?? '' },
},

The site heuristic has no public suffix list (siteOf in packages/e2e/src/internal/urls.ts): last two labels, or three for co.uk-style suffixes. It only scopes headers and frame capture now, so an error is a missing bypass header or a dropped frame, never a refused step.

Checklist

  • Changeset added (pnpm changeset) for any change to a published package, or the change is testbed, docs, or CI only.
  • Breaking change: title carries !, the changeset body names what breaks and what replaces it, and the deprecation warning landed a window earlier (stability policy in CONTRIBUTING.md). Title and changeset done; no deprecation window, removed outright by decision.
  • Docs updated in the same PR: the docs/**/*.mdx page for the behavior, and skills/e2e/ if the skill describes it.
  • Contract change: emitted .d.ts reviewed, tests/types/sdk-types.ts updated; wire change edits the schema and both fixtures. No wire change; the SDK types file drops the { value, allowedOrigins } secret form.
  • Engine contract change (@e2edev/e2e/engine): changesets for @e2edev/e2e, @e2edev/playwright, and @e2edev/agent-device.