Skip to content

Commit cf2cc00

Browse files
ryancbahanclaude
andcommitted
Clear login page on auth failure to prevent credential capture
Navigate to about:blank in the catch block before rethrowing so that failure artifacts (screenshots, trace snapshots) do not capture the login form with credentials still populated. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 657b467 commit cf2cc00

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

packages/e2e/helpers/browser-login.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,10 @@ export async function completeLogin(page: Page, loginUrl: string, email: string,
4646
// No confirmation page — expected
4747
}
4848
} catch (error) {
49-
// Intentionally omit page HTML from the error — it may contain filled
50-
// credential values in input elements, which would leak into test reports.
5149
const pageUrl = page.url()
50+
// Clear the page so failure artifacts (screenshots, trace snapshots) do
51+
// not capture the login form with credentials still populated.
52+
await page.goto('about:blank').catch(() => {})
5253
throw new Error(`Login failed at ${pageUrl}\nOriginal error: ${error}`)
5354
}
5455
}

0 commit comments

Comments
 (0)