feat(oauth): unify OAuth callback browser pages (#34025)

This commit is contained in:
Aiden Cline 2026-06-26 00:36:40 -05:00 committed by GitHub
commit e8fea9e63a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 322 additions and 329 deletions

View file

@ -0,0 +1,15 @@
import { describe, expect, test } from "bun:test"
import { OauthCallbackPage } from "../src/oauth/page"
describe("OauthCallbackPage", () => {
test("escapes bootstrap options embedded in the inline script", () => {
const html = OauthCallbackPage.bootstrap({
provider: `xAI</script><script>alert("provider")</script>`,
tokenPath: `/token</script><script>alert("path")</script>`,
})
expect(html.match(/<\/script>/g)).toHaveLength(1)
expect(html).toContain(`xAI\\u003c/script>\\u003cscript>alert(\\\"provider\\\")\\u003c/script>`)
expect(html).toContain(`/token\\u003c/script>\\u003cscript>alert(\\\"path\\\")\\u003c/script>`)
})
})