mirror of
https://github.com/anomalyco/opencode.git
synced 2026-07-19 17:03:30 +00:00
15 lines
667 B
TypeScript
15 lines
667 B
TypeScript
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>`)
|
|
})
|
|
})
|