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: resolve directory names in scan titles (#2121)

Suhail Patel5fb0d89fe3ef
diff --git a/sdk/typescript/docs/cli.md b/sdk/typescript/docs/cli.md
index faac0880e..ac7cde584 100644
--- a/sdk/typescript/docs/cli.md
+++ b/sdk/typescript/docs/cli.md
@@ -1007,8 +1007,9 @@ directory.
### Progress and cost
-Interactive scans show full-screen progress. CI, redirected output, `--headless`,
-and `--verbose` use plain status lines. Results go to stdout; progress and
+Interactive scans show full-screen progress. The dashboard title uses the resolved
+directory name, so `scan .` shows the current directory's name. CI, redirected output,
+`--headless`, and `--verbose` use plain status lines. Results go to stdout; progress and
diagnostics go to stderr. Press `d` in the dashboard for details, then `a` for
all sources, `m` for the main scan, or `1`–`9` for a worker.
diff --git a/sdk/typescript/src/cli.ts b/sdk/typescript/src/cli.ts
index 7ac811827..f9aa0d0a7 100644
--- a/sdk/typescript/src/cli.ts
+++ b/sdk/typescript/src/cli.ts
@@ -9522,7 +9522,7 @@ async function executeScan(
);
if (progress.interactive && !arguments_.dryRun && !verbose) {
dashboard = new ScanDashboard(errorOutput, {
- repository,
+ repository: resolveCliPath(directory, repository),
mode: arguments_.mode,
showCost,
model: scanModelConfiguration(await mergedCodexConfig(config)),
diff --git a/sdk/typescript/tests-ts/cli.test.ts b/sdk/typescript/tests-ts/cli.test.ts
index 6b3daf6cd..c493420d4 100644
--- a/sdk/typescript/tests-ts/cli.test.ts
+++ b/sdk/typescript/tests-ts/cli.test.ts
@@ -2654,6 +2654,34 @@ describe("CLI", () => {
expect(signals.listeners.get("SIGTERM")?.size).toBe(0);
});
+ test.each([
+ [undefined, "repository"],
+ [".", "repository"],
+ ["./", "repository"],
+ ["..", "workspace"],
+ ["./child", "child"],
+ ["./child/.", "child"],
+ ["./child/..", "repository"],
+ ["~/example-project/.", "example-project"],
+ ] as const)(
+ "shows the resolved directory name in the scan title for %p",
+ async (repository, name) => {
+ const { stderr, runCli } = createCliTest(main, { stderr: true });
+ expect(
+ await runCli(
+ ["scan", ...(repository === undefined ? [] : [repository])],
+ dependencies({
+ currentDirectory: resolve("/workspace/repository"),
+ environment: { NO_COLOR: "1" },
+ }),
+ ),
+ ).toBe(0);
+ expect(stripVTControlCharacters(stderr.text())).toContain(
+ `CODEX SECURITY · ${name} · `,
+ );
+ },
+ );
+
test("keeps terminal scans in one live dashboard", async () => {
const { stderr, runCli } = createCliTest(main, { stderr: true });