Open-source status page, incident response and uptime monitoring
TypeScript alertingincident-managementmcpmcp-servermonitoringmonitoring-as-codeobservabilityon-callopen-sourcesrestatus-pagestatuspagesynthetic-monitoringterraformtinybirdtursouptimeuptime-checkeruptime-monitor
chore: openapi apps challenge token (#2735)
Maximilian Kaske87625860d95c
diff --git a/apps/server/src/routes/oauth/index.ts b/apps/server/src/routes/oauth/index.tsindex bbbe7faca..2cdab6bda 100644--- a/apps/server/src/routes/oauth/index.ts+++ b/apps/server/src/routes/oauth/index.ts@@ -22,6 +22,9 @@ const logger = getLogger("api-server");const NO_STORE = { "Cache-Control": "no-store", Pragma: "no-cache" };+const OPENAI_APPS_CHALLENGE_TOKEN =+ "BY-vA_tzfuXZeVpuYKsUlluq9td0nTuyt-bTJXblZlw";+type Body = Record<string, string | undefined>;/** Token and revoke accept form-encoded (RFC 6749) and JSON bodies. */@@ -153,6 +156,11 @@ export function createOAuthRoutes(config: OAuthConfig) {c.json(protectedResourceMetadata(config.issuer)),);+ // ChatGPT app submission domain proof; the token is public, not a secret.+ app.get("/.well-known/openai-apps-challenge", (c) =>+ c.text(OPENAI_APPS_CHALLENGE_TOKEN),+ );+// RFC 7591app.post("/oauth/register", async (c) => {const json: unknown = await c.req.json().catch(() => null);diff --git a/apps/server/src/routes/oauth/oauth.test.ts b/apps/server/src/routes/oauth/oauth.test.tsindex 31766b8c0..c86b5ef83 100644--- a/apps/server/src/routes/oauth/oauth.test.ts+++ b/apps/server/src/routes/oauth/oauth.test.ts@@ -205,6 +205,15 @@ describe("well-known metadata", () => {});});+ test("openai apps domain challenge", async () => {+ const res = await app.request("/.well-known/openai-apps-challenge");+ expect(res.status).toBe(200);+ expect(res.headers.get("content-type")).toContain("text/plain");+ expect(await res.text()).toBe(+ "BY-vA_tzfuXZeVpuYKsUlluq9td0nTuyt-bTJXblZlw",+ );+ });+test("answers CORS preflight", async () => {const res = await app.request("/oauth/token", {method: "OPTIONS",