@openai/codex-security 0.1.14 → 0.1.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +74 -19
- package/_bundled_plugin/.app.json +5 -0
- package/_bundled_plugin/.codex-plugin/plugin.json +1 -1
- package/_bundled_plugin/examples/completed-scan/report.md +96 -0
- package/_bundled_plugin/mcp/server.mjs.br.part-000 +0 -0
- package/_bundled_plugin/mcp/server.mjs.br.part-001 +0 -0
- package/_bundled_plugin/references/config-preflight.md +5 -1
- package/_bundled_plugin/references/core-scan.md +6 -15
- package/_bundled_plugin/references/final-report.md +1 -1
- package/_bundled_plugin/references/scan-artifacts.md +1 -1
- package/_bundled_plugin/references/threat-model.md +64 -0
- package/_bundled_plugin/schemas/findings.schema.json +327 -2
- package/_bundled_plugin/schemas/tools/scan-draft.schema.json +286 -4
- package/_bundled_plugin/scripts/config_preflight.py +20 -1
- package/_bundled_plugin/scripts/deep_scan_workbench.py +12 -6
- package/_bundled_plugin/scripts/finalize_scan_contract.py +322 -33
- package/_bundled_plugin/scripts/finding_preview.py +81 -19
- package/_bundled_plugin/scripts/report_projection.py +253 -33
- package/_bundled_plugin/scripts/validate_scan_contract.py +5 -2
- package/_bundled_plugin/scripts/workbench_cli.py +7 -1
- package/_bundled_plugin/scripts/workbench_remediation.py +2 -0
- package/_bundled_plugin/skills/deep-security-scan/SKILL.md +4 -0
- package/_bundled_plugin/skills/security-diff-scan/SKILL.md +2 -2
- package/_bundled_plugin/skills/security-scan/SKILL.md +1 -1
- package/_bundled_plugin/skills/threat-model/SKILL.md +6 -49
- package/dist/api.d.ts +5 -73
- package/dist/api.d.ts.map +1 -1
- package/dist/api.js +259 -209
- package/dist/api.js.map +1 -1
- package/dist/bulk-scan-discovery.d.ts +3 -3
- package/dist/bulk-scan-discovery.d.ts.map +1 -1
- package/dist/bulk-scan-discovery.js +8 -7
- package/dist/bulk-scan-discovery.js.map +1 -1
- package/dist/cli.d.ts +18 -2
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +782 -120
- package/dist/cli.js.map +1 -1
- package/dist/codex-prompt.d.ts +4 -0
- package/dist/codex-prompt.d.ts.map +1 -0
- package/dist/codex-prompt.js +14 -0
- package/dist/codex-prompt.js.map +1 -0
- package/dist/contract.d.ts.map +1 -1
- package/dist/contract.js +198 -2
- package/dist/contract.js.map +1 -1
- package/dist/cost.d.ts +7 -0
- package/dist/cost.d.ts.map +1 -1
- package/dist/cost.js +68 -47
- package/dist/cost.js.map +1 -1
- package/dist/errors.d.ts +4 -0
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +9 -0
- package/dist/errors.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/linear.d.ts +19 -0
- package/dist/linear.d.ts.map +1 -0
- package/dist/linear.js +106 -0
- package/dist/linear.js.map +1 -0
- package/dist/models.d.ts +89 -2
- package/dist/models.d.ts.map +1 -1
- package/dist/models.js.map +1 -1
- package/dist/multiscan.d.ts.map +1 -1
- package/dist/multiscan.js +7 -6
- package/dist/multiscan.js.map +1 -1
- package/dist/patch-tui.d.ts +28 -0
- package/dist/patch-tui.d.ts.map +1 -0
- package/dist/patch-tui.js +384 -0
- package/dist/patch-tui.js.map +1 -0
- package/dist/publish.d.ts +2 -2
- package/dist/publish.d.ts.map +1 -1
- package/dist/publish.js +4 -8
- package/dist/publish.js.map +1 -1
- package/dist/runtime.d.ts +10 -7
- package/dist/runtime.d.ts.map +1 -1
- package/dist/runtime.js +63 -35
- package/dist/runtime.js.map +1 -1
- package/dist/scan-comparison.d.ts +2 -1
- package/dist/scan-comparison.d.ts.map +1 -1
- package/dist/scan-comparison.js +17 -15
- package/dist/scan-comparison.js.map +1 -1
- package/dist/scan-dashboard.d.ts +2 -1
- package/dist/scan-dashboard.d.ts.map +1 -1
- package/dist/scan-dashboard.js +219 -11
- package/dist/scan-dashboard.js.map +1 -1
- package/dist/targets.d.ts +1 -0
- package/dist/targets.d.ts.map +1 -1
- package/dist/targets.js +4 -2
- package/dist/targets.js.map +1 -1
- package/dist/trusted-executable.d.ts.map +1 -1
- package/dist/trusted-executable.js +26 -11
- package/dist/trusted-executable.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/version.js.map +1 -1
- package/package.json +7 -3
- package/_bundled_plugin/skills/threat-model/references/threat-model-guidance.md +0 -48
package/dist/version.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,MAAM,gBAAgB,GAAG,eAAe,CACtC,IAAI,GAAG,CAAC,iBAAiB,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAC5C,CAAC;AAEF,MAAM,CAAC,MAAM,OAAO,GAAG,gBAAgB,CAAC,OAAO,CAAC;AAChD,MAAM,CAAC,MAAM,iBAAiB,GAAG,gBAAgB,CAAC,GAAG,CAAC;AACtD,MAAM,CAAC,MAAM,wBAAwB,GAAG,gBAAgB,CAAC,UAAU,CAAC;AACpE,MAAM,CAAC,MAAM,sBAAsB,GAAG,QAAiB,CAAC;AAExD,MAAM,YAAY,GAAG,wBAAwB,CAAC;AAC9C,MAAM,eAAe,GACnB,mEAAmE,CAAC;AAQtE,MAAM,UAAU,mBAAmB,CAAC,WAA8B;IAChE,OAAO,CACL,WAAW,CAAC,iCAAiC,CAAC,KAAK,SAAS;QAC5D,WAAW,CAAC,oBAAoB,CAAC,KAAK,SAAS;QAC/C,WAAW,CAAC,IAAI,CAAC,KAAK,SAAS,CAChC,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,aAAa,CAC3B,cAAiC,OAAO,CAAC,GAAG,EAC5C,aAAqB,aAAa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AE;YACjE,KAAK,EAAE,KAAK;SACb,CAAC,CAAC;IACL,CAAC;AACH,CAAC","sourcesContent":["import { readFileSync } from \"node:fs\";\nimport { fileURLToPath } from \"node:url\";\n\nconst PACKAGE_VERSIONS = packageVersions(\n new URL(\"../package.json\", import.meta.url),\n);\n\nexport const VERSION = PACKAGE_VERSIONS.package;\nexport const CODEX_SDK_VERSION = PACKAGE_VERSIONS.sdk;\nexport const CODEX_EXECUTABLE_VERSION = PACKAGE_VERSIONS.executable;\nexport const BUNDLED_PLUGIN_VERSION = \"0.1.20\" as const;\n\nconst PACKAGE_NAME = \"@openai/codex-security\";\nconst VERSION_PATTERN =\n /^(\\d+)\\.(\\d+)\\.(\\d+)(?:-([0-9A-Za-z.-]+))?(?:\\+[0-9A-Za-z.-]+)?$/u;\n\nexport interface UpdateNotice {\n readonly currentVersion: string;\n readonly latestVersion: string;\n readonly command: string;\n}\n\nexport function updateNoticeEnabled(environment: NodeJS.ProcessEnv): boolean {\n return (\n environment[\"CODEX_SECURITY_NO_UPDATE_NOTICE\"] === undefined &&\n environment[\"NO_UPDATE_NOTIFIER\"] === undefined &&\n environment[\"CI\"] === undefined\n );\n}\n\nexport function updateCommand(\n environment: NodeJS.ProcessEnv = process.env,\n entrypoint: string = fileURLToPath(import.meta.url),\n): string {\n const path = entrypoint.replaceAll(\"\\\\\", \"/\").toLowerCase();\n const agent = (environment[\"npm_config_user_agent\"] ?? \"\").toLowerCase();\n\n if (\n environment[\"npm_command\"] === \"exec\" ||\n environment[\"npm_lifecycle_event\"] === \"npx\" ||\n path.includes(\"/_npx/\")\n ) {\n return `npx ${PACKAGE_NAME}@latest`;\n }\n if (path.includes(\"/.install/node_modules/\")) {\n return \"download and extract the latest Codex Security release\";\n }\n\n const global =\n environment[\"npm_config_global\"] === \"true\" ||\n path.includes(\"/lib/node_modules/\") ||\n path.includes(\"/appdata/roaming/npm/node_modules/\") ||\n path.includes(\"/pnpm/global/\") ||\n path.includes(\"/.bun/install/global/\") ||\n path.includes(\"/.yarn/global/\") ||\n path.includes(\"/yarn/global/\");\n\n if (agent.startsWith(\"pnpm/\") || path.includes(\"/.pnpm/\")) {\n return `pnpm add${global ? \" -g\" : \"\"} ${PACKAGE_NAME}@latest`;\n }\n if (\n agent.startsWith(\"yarn/\") ||\n path.includes(\"/.yarn/\") ||\n path.includes(\"/yarn/global/\")\n ) {\n return `yarn${global ? \" global\" : \"\"} add ${PACKAGE_NAME}@latest`;\n }\n if (agent.startsWith(\"bun/\") || path.includes(\"/.bun/\")) {\n return `bun add${global ? \" -g\" : \"\"} ${PACKAGE_NAME}@latest`;\n }\n return agent.startsWith(\"npm/\") || path.includes(\"/node_modules/\")\n ? `npm install${global ? \" -g\" : \"\"} ${PACKAGE_NAME}@latest`\n : `npx ${PACKAGE_NAME}@latest`;\n}\n\nexport async function checkForUpdate({\n environment = process.env,\n entrypoint,\n currentVersion = VERSION,\n fetch: fetchLatest = fetch,\n signal,\n}: {\n environment?: NodeJS.ProcessEnv;\n entrypoint?: string;\n currentVersion?: string;\n fetch?: (\n input: Parameters<typeof fetch>[0],\n init?: Parameters<typeof fetch>[1],\n ) => ReturnType<typeof fetch>;\n signal?: AbortSignal;\n} = {}): Promise<UpdateNotice | undefined> {\n if (!updateNoticeEnabled(environment)) return undefined;\n\n try {\n const registry =\n environment[\"CODEX_SECURITY_NPM_REGISTRY\"] ??\n environment[\"npm_config_registry\"] ??\n environment[\"NPM_CONFIG_REGISTRY\"] ??\n \"https://registry.npmjs.org/\";\n const timeout = AbortSignal.timeout(3_000);\n const response = await fetchLatest(\n new URL(\n `${encodeURIComponent(PACKAGE_NAME)}/latest`,\n registry.endsWith(\"/\") ? registry : `${registry}/`,\n ),\n {\n signal:\n signal === undefined ? timeout : AbortSignal.any([signal, timeout]),\n },\n );\n if (!response.ok) return undefined;\n\n const manifest: unknown = await response.json();\n if (\n typeof manifest !== \"object\" ||\n manifest === null ||\n !(\"version\" in manifest) ||\n typeof manifest.version !== \"string\" ||\n !isNewerVersion(manifest.version, currentVersion)\n ) {\n return undefined;\n }\n\n return {\n currentVersion,\n latestVersion: manifest.version,\n command: updateCommand(environment, entrypoint),\n };\n } catch {\n return undefined;\n }\n}\n\nexport function formatUpdateNotice(notice: UpdateNotice): string {\n const lines = [\n `Codex Security update available: ${notice.currentVersion} → ${notice.latestVersion}`,\n `Run: ${notice.command}`,\n ];\n const width = Math.max(...lines.map((line) => line.length));\n return [\n \"\",\n `╭${\"─\".repeat(width + 2)}╮`,\n ...lines.map((line) => `│ ${line.padEnd(width)} │`),\n `╰${\"─\".repeat(width + 2)}╯`,\n \"\",\n ].join(\"\\n\");\n}\n\nfunction isNewerVersion(latest: string, current: string): boolean {\n const candidate = VERSION_PATTERN.exec(latest);\n const installed = VERSION_PATTERN.exec(current);\n if (candidate === null || installed === null) return false;\n\n for (let index = 1; index <= 3; index += 1) {\n const difference = Number(candidate[index]) - Number(installed[index]);\n if (difference !== 0) return difference > 0;\n }\n\n if (candidate[4] === installed[4]) return false;\n if (candidate[4] === undefined) return true;\n if (installed[4] === undefined) return false;\n return (\n new Intl.Collator(\"en\", { numeric: true }).compare(\n candidate[4],\n installed[4],\n ) > 0\n );\n}\n\nfunction packageVersions(url: URL): {\n package: string;\n sdk: string;\n executable: string;\n} {\n try {\n const manifest: unknown = JSON.parse(readFileSync(url, \"utf8\"));\n if (\n typeof manifest !== \"object\" ||\n manifest === null ||\n !(\"version\" in manifest) ||\n typeof manifest.version !== \"string\" ||\n manifest.version.length === 0\n ) {\n throw new Error(\"version must be a non-empty string\");\n }\n const dependencies =\n \"dependencies\" in manifest ? manifest.dependencies : undefined;\n if (typeof dependencies !== \"object\" || dependencies === null) {\n throw new Error(\"dependencies must be an object\");\n }\n const sdk =\n \"@openai/codex-sdk\" in dependencies\n ? dependencies[\"@openai/codex-sdk\"]\n : undefined;\n const executable =\n \"@openai/codex\" in dependencies\n ? dependencies[\"@openai/codex\"]\n : undefined;\n if (\n typeof sdk !== \"string\" ||\n sdk.length === 0 ||\n typeof executable !== \"string\" ||\n executable.length === 0\n ) {\n throw new Error(\"Codex dependencies must have non-empty versions\");\n }\n return { package: manifest.version, sdk, executable };\n } catch (error) {\n throw new Error(\"Unable to read Codex Security package versions.\", {\n cause: error,\n });\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,MAAM,gBAAgB,GAAG,eAAe,CACtC,IAAI,GAAG,CAAC,iBAAiB,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAC5C,CAAC;AAEF,MAAM,CAAC,MAAM,OAAO,GAAG,gBAAgB,CAAC,OAAO,CAAC;AAChD,MAAM,CAAC,MAAM,iBAAiB,GAAG,gBAAgB,CAAC,GAAG,CAAC;AACtD,MAAM,CAAC,MAAM,wBAAwB,GAAG,gBAAgB,CAAC,UAAU,CAAC;AACpE,MAAM,CAAC,MAAM,sBAAsB,GAAG,QAAiB,CAAC;AAExD,MAAM,YAAY,GAAG,wBAAwB,CAAC;AAC9C,MAAM,eAAe,GACnB,mEAAmE,CAAC;AAQtE,MAAM,UAAU,mBAAmB,CAAC,WAA8B;IAChE,OAAO,CACL,WAAW,CAAC,iCAAiC,CAAC,KAAK,SAAS;QAC5D,WAAW,CAAC,oBAAoB,CAAC,KAAK,SAAS;QAC/C,WAAW,CAAC,IAAI,CAAC,KAAK,SAAS,CAChC,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,aAAa,CAC3B,cAAiC,OAAO,CAAC,GAAG,EAC5C,aAAqB,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC;IAEnD,MAAM,IAAI,GAAG,UAAU,CAAC,UAAU,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,WAAW,EAAE,CAAC;IAC5D,MAAM,KAAK,GAAG,CAAC,WA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AAC,SAAS,IAAI,QAAQ,CAAC;YACxB,OAAO,QAAQ,CAAC,OAAO,KAAK,QAAQ;YACpC,QAAQ,CAAC,OAAO,CAAC,MAAM,KAAK,CAAC,EAC7B,CAAC;YACD,MAAM,IAAI,KAAK,CAAC,oCAAoC,CAAC,CAAC;QACxD,CAAC;QACD,MAAM,YAAY,GAChB,cAAc,IAAI,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC,CAAC,SAAS,CAAC;QACjE,IAAI,OAAO,YAAY,KAAK,QAAQ,IAAI,YAAY,KAAK,IAAI,EAAE,CAAC;YAC9D,MAAM,IAAI,KAAK,CAAC,gCAAgC,CAAC,CAAC;QACpD,CAAC;QACD,MAAM,GAAG,GACP,mBAAmB,IAAI,YAAY;YACjC,CAAC,CAAC,YAAY,CAAC,mBAAmB,CAAC;YACnC,CAAC,CAAC,SAAS,CAAC;QAChB,MAAM,UAAU,GACd,eAAe,IAAI,YAAY;YAC7B,CAAC,CAAC,YAAY,CAAC,eAAe,CAAC;YAC/B,CAAC,CAAC,SAAS,CAAC;QAChB,IACE,OAAO,GAAG,KAAK,QAAQ;YACvB,GAAG,CAAC,MAAM,KAAK,CAAC;YAChB,OAAO,UAAU,KAAK,QAAQ;YAC9B,UAAU,CAAC,MAAM,KAAK,CAAC,EACvB,CAAC;YACD,MAAM,IAAI,KAAK,CAAC,iDAAiD,CAAC,CAAC;QACrE,CAAC;QACD,OAAO,EAAE,OAAO,EAAE,QAAQ,CAAC,OAAO,EAAE,GAAG,EAAE,UAAU,EAAE,CAAC;IACxD,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,IAAI,KAAK,CAAC,iDAAiD,EAAE;YACjE,KAAK,EAAE,KAAK;SACb,CAAC,CAAC;IACL,CAAC;AACH,CAAC","sourcesContent":["import { readFileSync } from \"node:fs\";\nimport { fileURLToPath } from \"node:url\";\n\nconst PACKAGE_VERSIONS = packageVersions(\n new URL(\"../package.json\", import.meta.url),\n);\n\nexport const VERSION = PACKAGE_VERSIONS.package;\nexport const CODEX_SDK_VERSION = PACKAGE_VERSIONS.sdk;\nexport const CODEX_EXECUTABLE_VERSION = PACKAGE_VERSIONS.executable;\nexport const BUNDLED_PLUGIN_VERSION = \"0.1.22\" as const;\n\nconst PACKAGE_NAME = \"@openai/codex-security\";\nconst VERSION_PATTERN =\n /^(\\d+)\\.(\\d+)\\.(\\d+)(?:-([0-9A-Za-z.-]+))?(?:\\+[0-9A-Za-z.-]+)?$/u;\n\nexport interface UpdateNotice {\n readonly currentVersion: string;\n readonly latestVersion: string;\n readonly command: string;\n}\n\nexport function updateNoticeEnabled(environment: NodeJS.ProcessEnv): boolean {\n return (\n environment[\"CODEX_SECURITY_NO_UPDATE_NOTICE\"] === undefined &&\n environment[\"NO_UPDATE_NOTIFIER\"] === undefined &&\n environment[\"CI\"] === undefined\n );\n}\n\nexport function updateCommand(\n environment: NodeJS.ProcessEnv = process.env,\n entrypoint: string = fileURLToPath(import.meta.url),\n): string {\n const path = entrypoint.replaceAll(\"\\\\\", \"/\").toLowerCase();\n const agent = (environment[\"npm_config_user_agent\"] ?? \"\").toLowerCase();\n\n if (\n environment[\"npm_command\"] === \"exec\" ||\n environment[\"npm_lifecycle_event\"] === \"npx\" ||\n path.includes(\"/_npx/\")\n ) {\n return `npx ${PACKAGE_NAME}@latest`;\n }\n if (path.includes(\"/.install/node_modules/\")) {\n return \"download and extract the latest Codex Security release\";\n }\n\n const global =\n environment[\"npm_config_global\"] === \"true\" ||\n path.includes(\"/lib/node_modules/\") ||\n path.includes(\"/appdata/roaming/npm/node_modules/\") ||\n path.includes(\"/pnpm/global/\") ||\n path.includes(\"/.bun/install/global/\") ||\n path.includes(\"/.yarn/global/\") ||\n path.includes(\"/yarn/global/\");\n\n if (agent.startsWith(\"pnpm/\") || path.includes(\"/.pnpm/\")) {\n return `pnpm add${global ? \" -g\" : \"\"} ${PACKAGE_NAME}@latest`;\n }\n if (\n agent.startsWith(\"yarn/\") ||\n path.includes(\"/.yarn/\") ||\n path.includes(\"/yarn/global/\")\n ) {\n return `yarn${global ? \" global\" : \"\"} add ${PACKAGE_NAME}@latest`;\n }\n if (agent.startsWith(\"bun/\") || path.includes(\"/.bun/\")) {\n return `bun add${global ? \" -g\" : \"\"} ${PACKAGE_NAME}@latest`;\n }\n return agent.startsWith(\"npm/\") || path.includes(\"/node_modules/\")\n ? `npm install${global ? \" -g\" : \"\"} ${PACKAGE_NAME}@latest`\n : `npx ${PACKAGE_NAME}@latest`;\n}\n\nexport async function checkForUpdate({\n environment = process.env,\n entrypoint,\n currentVersion = VERSION,\n fetch: fetchLatest = fetch,\n signal,\n}: {\n environment?: NodeJS.ProcessEnv;\n entrypoint?: string;\n currentVersion?: string;\n fetch?: (\n input: Parameters<typeof fetch>[0],\n init?: Parameters<typeof fetch>[1],\n ) => ReturnType<typeof fetch>;\n signal?: AbortSignal;\n} = {}): Promise<UpdateNotice | undefined> {\n if (!updateNoticeEnabled(environment)) return undefined;\n\n try {\n const registry =\n environment[\"CODEX_SECURITY_NPM_REGISTRY\"] ??\n environment[\"npm_config_registry\"] ??\n environment[\"NPM_CONFIG_REGISTRY\"] ??\n \"https://registry.npmjs.org/\";\n const timeout = AbortSignal.timeout(3_000);\n const response = await fetchLatest(\n new URL(\n `${encodeURIComponent(PACKAGE_NAME)}/latest`,\n registry.endsWith(\"/\") ? registry : `${registry}/`,\n ),\n {\n signal:\n signal === undefined ? timeout : AbortSignal.any([signal, timeout]),\n },\n );\n if (!response.ok) return undefined;\n\n const manifest: unknown = await response.json();\n if (\n typeof manifest !== \"object\" ||\n manifest === null ||\n !(\"version\" in manifest) ||\n typeof manifest.version !== \"string\" ||\n !isNewerVersion(manifest.version, currentVersion)\n ) {\n return undefined;\n }\n\n return {\n currentVersion,\n latestVersion: manifest.version,\n command: updateCommand(environment, entrypoint),\n };\n } catch {\n return undefined;\n }\n}\n\nexport function formatUpdateNotice(notice: UpdateNotice): string {\n const lines = [\n `Codex Security update available: ${notice.currentVersion} → ${notice.latestVersion}`,\n `Run: ${notice.command}`,\n ];\n const width = Math.max(...lines.map((line) => line.length));\n return [\n \"\",\n `╭${\"─\".repeat(width + 2)}╮`,\n ...lines.map((line) => `│ ${line.padEnd(width)} │`),\n `╰${\"─\".repeat(width + 2)}╯`,\n \"\",\n ].join(\"\\n\");\n}\n\nfunction isNewerVersion(latest: string, current: string): boolean {\n const candidate = VERSION_PATTERN.exec(latest);\n const installed = VERSION_PATTERN.exec(current);\n if (candidate === null || installed === null) return false;\n\n for (let index = 1; index <= 3; index += 1) {\n const difference = Number(candidate[index]) - Number(installed[index]);\n if (difference !== 0) return difference > 0;\n }\n\n if (candidate[4] === installed[4]) return false;\n if (candidate[4] === undefined) return true;\n if (installed[4] === undefined) return false;\n return (\n new Intl.Collator(\"en\", { numeric: true }).compare(\n candidate[4],\n installed[4],\n ) > 0\n );\n}\n\nfunction packageVersions(url: URL): {\n package: string;\n sdk: string;\n executable: string;\n} {\n try {\n const manifest: unknown = JSON.parse(readFileSync(url, \"utf8\"));\n if (\n typeof manifest !== \"object\" ||\n manifest === null ||\n !(\"version\" in manifest) ||\n typeof manifest.version !== \"string\" ||\n manifest.version.length === 0\n ) {\n throw new Error(\"version must be a non-empty string\");\n }\n const dependencies =\n \"dependencies\" in manifest ? manifest.dependencies : undefined;\n if (typeof dependencies !== \"object\" || dependencies === null) {\n throw new Error(\"dependencies must be an object\");\n }\n const sdk =\n \"@openai/codex-sdk\" in dependencies\n ? dependencies[\"@openai/codex-sdk\"]\n : undefined;\n const executable =\n \"@openai/codex\" in dependencies\n ? dependencies[\"@openai/codex\"]\n : undefined;\n if (\n typeof sdk !== \"string\" ||\n sdk.length === 0 ||\n typeof executable !== \"string\" ||\n executable.length === 0\n ) {\n throw new Error(\"Codex dependencies must have non-empty versions\");\n }\n return { package: manifest.version, sdk, executable };\n } catch (error) {\n throw new Error(\"Unable to read Codex Security package versions.\", {\n cause: error,\n });\n }\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openai/codex-security",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.15",
|
|
4
4
|
"description": "TypeScript SDK and CLI for Codex Security",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "OpenAI",
|
|
@@ -48,25 +48,29 @@
|
|
|
48
48
|
"fast-uri": "3.1.5",
|
|
49
49
|
"fflate": "0.8.2",
|
|
50
50
|
"incur": "0.4.13",
|
|
51
|
+
"ink": "6.8.0",
|
|
51
52
|
"papaparse": "5.5.3",
|
|
52
53
|
"pdfjs-dist": "6.2.108",
|
|
54
|
+
"react": "19.2.4",
|
|
53
55
|
"smol-toml": "1.6.1"
|
|
54
56
|
},
|
|
55
57
|
"devDependencies": {
|
|
56
58
|
"@types/bun": "1.3.13",
|
|
57
59
|
"@types/node": "22.19.17",
|
|
58
60
|
"@types/papaparse": "5.3.15",
|
|
61
|
+
"@types/react": "19.2.14",
|
|
62
|
+
"ink-testing-library": "4.0.0",
|
|
59
63
|
"json-schema-to-typescript": "15.0.4",
|
|
60
64
|
"prettier": "3.2.5",
|
|
61
65
|
"typescript": "5.7.3"
|
|
62
66
|
},
|
|
63
|
-
"gitHead": "
|
|
67
|
+
"gitHead": "b920ca4536a9ff4f24a32d895d4f7bb90fec76b4",
|
|
64
68
|
"scripts": {
|
|
65
69
|
"audit:prod": "pnpm audit --prod --audit-level high",
|
|
66
70
|
"clean": "node -e \"require('node:fs').rmSync('dist',{recursive:true,force:true})\"",
|
|
67
71
|
"build": "node --run clean && tsc -p tsconfig.build.json",
|
|
68
72
|
"check:package": "node scripts/check-package.mjs",
|
|
69
|
-
"format": "prettier --check --ignore-path .gitignore --ignore-path .prettierignore \"**/*.{cjs,mjs,js,ts,json,md}\"",
|
|
73
|
+
"format": "prettier --check --ignore-path .gitignore --ignore-path .prettierignore \"**/*.{cjs,mjs,js,ts,tsx,json,md}\"",
|
|
70
74
|
"generate:models": "node scripts/generate-models.cjs",
|
|
71
75
|
"generate:models:check": "node scripts/generate-models.cjs --check",
|
|
72
76
|
"lint": "tsc --noEmit",
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
# Threat Model Guidance
|
|
2
|
-
|
|
3
|
-
Use this guidance during threat model generation.
|
|
4
|
-
|
|
5
|
-
## Threat Model Generation Checklist
|
|
6
|
-
|
|
7
|
-
Do not restate this checklist in the final threat model output.
|
|
8
|
-
|
|
9
|
-
- Start at the repository root and use the minimum hops needed to understand the repository's real-world purpose before narrowing into critical components.
|
|
10
|
-
- Keep this phase at repository scope unless the user explicitly asks for a narrower target-scoped threat model.
|
|
11
|
-
- Ignore any reviewed commit, diff, changed files, changed directories, commit title, and scan target during threat model generation unless the user explicitly asks for narrower scope.
|
|
12
|
-
- Distinguish primary product or runtime code from developer-only, test-only, documentation-only, example, prototype, or one-off tooling paths.
|
|
13
|
-
- Identify the primary product or runtime surfaces the repository actually exposes.
|
|
14
|
-
- Identify the main trust boundaries and which actors sit on each side of them.
|
|
15
|
-
- Explicitly separate attacker-controlled, operator-controlled, and developer-controlled inputs.
|
|
16
|
-
- Describe common vulnerability classes that are relevant in this repository context rather than findings about the current diff.
|
|
17
|
-
- Call out mitigations, robustness measures, and security controls already present in the repository when they materially affect severity or scope.
|
|
18
|
-
- Explain when attacker stories are realistic, when they are out of scope, and when the repository's real-world usage makes a vulnerability class less important.
|
|
19
|
-
- Note unique security considerations for the codebase, for example:
|
|
20
|
-
- authn/authz, session management, CSRF, XSS, SSRF, injections, tenant boundaries, rate limits, and secret handling for web applications
|
|
21
|
-
- key management, privacy assumptions, ACLs/RBAC, PII handling, and auditability for cryptography or privacy-sensitive systems
|
|
22
|
-
- public interfaces, embedding assumptions, safe-by-default behavior, footguns, and secure usage patterns for libraries or frameworks
|
|
23
|
-
- production/runtime code paths versus CI, build, or local developer tooling
|
|
24
|
-
- Explain when a vulnerability class would be critical, high, medium, or low in this repository and give a couple of concrete examples at each level.
|
|
25
|
-
- If a vulnerability class requires attacker control that does not exist in the repo's real-world usage, say so in the severity calibration discussion.
|
|
26
|
-
- When possible, point to specific files, components, or controls that ground the threat model.
|
|
27
|
-
|
|
28
|
-
## Output Contract
|
|
29
|
-
|
|
30
|
-
When generating a threat model, structure it in Markdown with these sections:
|
|
31
|
-
|
|
32
|
-
- Overview
|
|
33
|
-
- Threat Model, Trust Boundaries, and Assumptions
|
|
34
|
-
- Attack Surface, Mitigations, and Attacker Stories
|
|
35
|
-
- Severity Calibration (Critical, High, Medium, Low)
|
|
36
|
-
|
|
37
|
-
The threat model should help a security researcher understand the codebase and its likely security-relevant failure modes. It should be detailed, repository-scoped, and suitable for reuse across unrelated diffs in the same repo.
|
|
38
|
-
|
|
39
|
-
Within those sections, make sure the output covers:
|
|
40
|
-
|
|
41
|
-
- repository overview and intended real-world usage
|
|
42
|
-
- trust boundaries and assumptions
|
|
43
|
-
- attacker stories and out-of-scope attacker stories
|
|
44
|
-
- attack surfaces and existing mitigations
|
|
45
|
-
- which vulnerability classes matter most in context
|
|
46
|
-
- which vulnerability classes are less severe or out of scope in context
|
|
47
|
-
- severity calibration with concrete examples at each level
|
|
48
|
-
- references to concrete files or controls when those materially ground the model
|