chore(opencode): consolidate escape logic (#32360)

This commit is contained in:
Aiden Cline
2026-06-14 20:27:02 -05:00
committed by GitHub
parent a9a4b2f00f
commit a774c62eac
7 changed files with 44 additions and 51 deletions
@@ -4,6 +4,7 @@ import {
parseJwtClaims,
extractAccountIdFromClaims,
extractAccountId,
renderOAuthError,
type IdTokenClaims,
} from "../../src/plugin/openai/codex"
@@ -14,6 +15,14 @@ function createTestJwt(payload: object): string {
}
describe("plugin.codex", () => {
test("escapes provider errors in callback HTML", () => {
const error = `</div><script>alert("xss" & 'more')</script>`
const html = renderOAuthError(error)
expect(html).toContain("&lt;/div&gt;&lt;script&gt;alert(&quot;xss&quot; &amp; &#39;more&#39;)&lt;/script&gt;")
expect(html).not.toContain(error)
})
describe("parseJwtClaims", () => {
test("parses valid JWT with claims", () => {
const payload = { email: "test@example.com", chatgpt_account_id: "acc-123" }