Skip to content

OpenAI's Codex Security CLI and TypeScript SDK for finding, validating, and fixing security vulnerabilities. npm: https://www.npmjs.com/package/@openai/codex-security

fix: redirect findings service root to dashboard (#948)

mluck-openai2d8427b7a342
diff --git a/sdk/typescript/scripts/smoke-package.mjs b/sdk/typescript/scripts/smoke-package.mjs
index 60945f75d..599b5cf1b 100644
--- a/sdk/typescript/scripts/smoke-package.mjs
+++ b/sdk/typescript/scripts/smoke-package.mjs
@@ -760,6 +760,7 @@ try {
try {
const base = `http://127.0.0.1:${dashboardServer.address().port}`;
for (const [path, contentType] of [
+ ["/", "text/html"],
["/dashboard", "text/html"],
["/dashboard/app.js", "text/javascript"],
["/dashboard/app.css", "text/css"],
diff --git a/sdk/typescript/src/server/dashboard.ts b/sdk/typescript/src/server/dashboard.ts
index e0dc28804..a49565a13 100644
--- a/sdk/typescript/src/server/dashboard.ts
+++ b/sdk/typescript/src/server/dashboard.ts
@@ -15,7 +15,7 @@ export async function serveDashboard(
path: string,
response: ServerResponse,
): Promise<boolean> {
- if (path === "/dashboard") {
+ if (path === "/" || path === "/dashboard") {
response.writeHead(308, { Location: "dashboard/" });
response.end();
return true;
diff --git a/sdk/typescript/tests-ts/findings-server.test.ts b/sdk/typescript/tests-ts/findings-server.test.ts
index c53cf36b0..644478c61 100644
--- a/sdk/typescript/tests-ts/findings-server.test.ts
+++ b/sdk/typescript/tests-ts/findings-server.test.ts
@@ -134,13 +134,15 @@ test("dashboard serves only findings and groups, and never calls an embedding pr
throw new Error("Read-only dashboard called embeddings");
},
});
- const redirect = await fetch(`${base}/dashboard`, { redirect: "manual" });
- expect(redirect.status).toBe(308);
- for (const prefix of ["", "/service"]) {
- expect(
- new URL(redirect.headers.get("location")!, `${base}${prefix}/dashboard`)
- .pathname,
- ).toBe(`${prefix}/dashboard/`);
+ for (const path of ["/", "/dashboard"]) {
+ const redirect = await fetch(`${base}${path}`, { redirect: "manual" });
+ expect(redirect.status).toBe(308);
+ for (const prefix of ["", "/service"]) {
+ expect(
+ new URL(redirect.headers.get("location")!, `${base}${prefix}${path}`)
+ .pathname,
+ ).toBe(`${prefix}/dashboard/`);
+ }
}
for (const view of ["findings", "groups"]) {
const result = await dashboard(base, { view });