@openai/codex-security 0.1.24 → 0.1.25
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 +177 -19
- package/_bundled_plugin/.codex-plugin/plugin.json +1 -1
- 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/scripts/rank_preview.py +11 -1
- package/_bundled_plugin/scripts/workbench_cli.py +8 -1
- package/_bundled_plugin/scripts/workbench_db.py +44 -2
- package/_bundled_plugin/scripts/workbench_scan_history.py +374 -66
- package/_bundled_plugin/scripts/workbench_schema.py +15 -0
- package/_bundled_plugin/scripts/workbench_target.py +86 -12
- package/dist/api.d.ts +15 -2
- package/dist/api.d.ts.map +1 -1
- package/dist/api.js +330 -28
- package/dist/api.js.map +1 -1
- package/dist/auth.d.ts.map +1 -1
- package/dist/auth.js +35 -3
- package/dist/auth.js.map +1 -1
- package/dist/cli.d.ts +2 -0
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +86 -33
- package/dist/cli.js.map +1 -1
- package/dist/component-plan.d.ts.map +1 -1
- package/dist/component-plan.js +4 -2
- package/dist/component-plan.js.map +1 -1
- package/dist/component-scan.d.ts.map +1 -1
- package/dist/component-scan.js +21 -6
- package/dist/component-scan.js.map +1 -1
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +46 -2
- package/dist/config.js.map +1 -1
- package/dist/cost.d.ts +1 -0
- package/dist/cost.d.ts.map +1 -1
- package/dist/cost.js +23 -11
- package/dist/cost.js.map +1 -1
- package/dist/deduplication/checkpointed-review.d.ts.map +1 -1
- package/dist/deduplication/checkpointed-review.js +2 -1
- package/dist/deduplication/checkpointed-review.js.map +1 -1
- package/dist/deduplication/codex-review.d.ts +3 -0
- package/dist/deduplication/codex-review.d.ts.map +1 -1
- package/dist/deduplication/codex-review.js +122 -36
- package/dist/deduplication/codex-review.js.map +1 -1
- package/dist/deduplication/deduplication-prompts.d.ts +4 -3
- package/dist/deduplication/deduplication-prompts.d.ts.map +1 -1
- package/dist/deduplication/deduplication-prompts.js +18 -9
- package/dist/deduplication/deduplication-prompts.js.map +1 -1
- package/dist/deduplication/deduplication-reviewer.d.ts +2 -7
- package/dist/deduplication/deduplication-reviewer.d.ts.map +1 -1
- package/dist/deduplication/deduplication-reviewer.js +46 -24
- package/dist/deduplication/deduplication-reviewer.js.map +1 -1
- package/dist/deduplication/deduplication.d.ts.map +1 -1
- package/dist/deduplication/deduplication.js +186 -23
- package/dist/deduplication/deduplication.js.map +1 -1
- package/dist/deduplication/scan.d.ts +9 -1
- package/dist/deduplication/scan.d.ts.map +1 -1
- package/dist/deduplication/scan.js +24 -7
- package/dist/deduplication/scan.js.map +1 -1
- package/dist/errors.d.ts +13 -0
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +7 -0
- package/dist/errors.js.map +1 -1
- package/dist/index.d.ts +5 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/mock-scan.d.ts +4 -0
- package/dist/mock-scan.d.ts.map +1 -0
- package/dist/mock-scan.js +210 -0
- package/dist/mock-scan.js.map +1 -0
- package/dist/publish.d.ts.map +1 -1
- package/dist/publish.js +2 -2
- package/dist/publish.js.map +1 -1
- package/dist/runtime.d.ts +1 -0
- package/dist/runtime.d.ts.map +1 -1
- package/dist/runtime.js +49 -14
- package/dist/runtime.js.map +1 -1
- package/dist/scan-comparison.d.ts +11 -2
- package/dist/scan-comparison.d.ts.map +1 -1
- package/dist/scan-comparison.js +237 -39
- package/dist/scan-comparison.js.map +1 -1
- package/dist/scan-dashboard.d.ts +3 -1
- package/dist/scan-dashboard.d.ts.map +1 -1
- package/dist/scan-dashboard.js +70 -3
- package/dist/scan-dashboard.js.map +1 -1
- package/dist/scan-history-renderer.d.ts.map +1 -1
- package/dist/scan-history-renderer.js +21 -0
- package/dist/scan-history-renderer.js.map +1 -1
- package/dist/server/api.d.ts +6 -0
- package/dist/server/api.d.ts.map +1 -0
- package/dist/server/api.js +4 -0
- package/dist/server/api.js.map +1 -0
- package/dist/server/dashboard/app.css +1 -1
- package/dist/server/embeddings.d.ts +2 -1
- package/dist/server/embeddings.d.ts.map +1 -1
- package/dist/server/embeddings.js +8 -3
- package/dist/server/embeddings.js.map +1 -1
- package/dist/server/serve.d.ts.map +1 -1
- package/dist/server/serve.js +1 -1
- package/dist/server/serve.js.map +1 -1
- package/dist/targets.d.ts.map +1 -1
- package/dist/targets.js +3 -5
- package/dist/targets.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 +9 -4
package/dist/runtime.js
CHANGED
|
@@ -4,7 +4,7 @@ import { chmodSync, constants, existsSync, readdirSync, } from "node:fs";
|
|
|
4
4
|
import { chmod, cp, copyFile, link, lstat, mkdir, mkdtemp, open, readFile, readdir, realpath, rename, rm, rmdir, stat, utimes, writeFile, } from "node:fs/promises";
|
|
5
5
|
import { homedir, tmpdir } from "node:os";
|
|
6
6
|
import { createRequire } from "node:module";
|
|
7
|
-
import { basename, dirname, extname, isAbsolute, join, relative, resolve, sep, } from "node:path";
|
|
7
|
+
import { basename, dirname, extname, isAbsolute, join, relative, resolve, sep, win32, } from "node:path";
|
|
8
8
|
import { createInterface } from "node:readline";
|
|
9
9
|
import { fileURLToPath } from "node:url";
|
|
10
10
|
import { promisify } from "node:util";
|
|
@@ -621,7 +621,7 @@ async function secureWindowsCredentialHome(path) {
|
|
|
621
621
|
" if ($entry.PSObject.TypeNames -notcontains 'System.IO.DirectoryInfo' -and $entry.PSObject.TypeNames -notcontains 'System.IO.FileInfo') { throw 'Windows credential home contains an unsafe entry' }",
|
|
622
622
|
" try { Write-CredentialAcl $entry.FullName } catch {",
|
|
623
623
|
// A descendant can disappear inside Get-Acl after it was enumerated.
|
|
624
|
-
` if ($_.FullyQualifiedErrorId -eq 'System.IO.FileNotFoundException,Microsoft.PowerShell.Commands.GetAclCommand') { exit ${WINDOWS_CREDENTIAL_DESCENDANTS_CHANGED_EXIT_CODE} }`,
|
|
624
|
+
` if ($_.FullyQualifiedErrorId -eq 'System.IO.FileNotFoundException,Microsoft.PowerShell.Commands.GetAclCommand' -or $_.FullyQualifiedErrorId -eq 'GetAcl_PathNotFound_Exception,Microsoft.PowerShell.Commands.GetAclCommand') { exit ${WINDOWS_CREDENTIAL_DESCENDANTS_CHANGED_EXIT_CODE} }`,
|
|
625
625
|
" if ($_.FullyQualifiedErrorId -like 'GetAcl_PathNotFound,*') { continue }",
|
|
626
626
|
" throw",
|
|
627
627
|
" }",
|
|
@@ -1112,23 +1112,49 @@ export async function preparePersistentOutputRoot(stateDirectory, category, repo
|
|
|
1112
1112
|
}
|
|
1113
1113
|
return root;
|
|
1114
1114
|
}
|
|
1115
|
+
const workbenchComparisonSupport = new Map();
|
|
1115
1116
|
export async function runWorkbench(options, args, input) {
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
const result = await runCodexCommand({ command: options.python }, [
|
|
1119
|
-
"-I",
|
|
1120
|
-
"-X",
|
|
1121
|
-
"utf8",
|
|
1122
|
-
"-B",
|
|
1123
|
-
join(options.pluginRoot, "scripts", "workbench_db.py"),
|
|
1124
|
-
...args,
|
|
1125
|
-
], pluginHelperEnvironment(options.environment), input, options.signal);
|
|
1117
|
+
const script = join(options.pluginRoot, "scripts", "workbench_db.py");
|
|
1118
|
+
const run = async (arguments_, input) => {
|
|
1119
|
+
const result = await runCodexCommand({ command: options.python }, ["-I", "-X", "utf8", "-B", script, ...arguments_], pluginHelperEnvironment(options.environment), input, options.signal);
|
|
1126
1120
|
if (!result.success) {
|
|
1127
1121
|
throw new Error(result.stderr.trim() ||
|
|
1128
1122
|
result.stdout.trim() ||
|
|
1129
1123
|
`Workbench exited with status ${result.exitCode}.`);
|
|
1130
1124
|
}
|
|
1131
|
-
|
|
1125
|
+
return result.stdout;
|
|
1126
|
+
};
|
|
1127
|
+
let stdout;
|
|
1128
|
+
try {
|
|
1129
|
+
const arguments_ = [...args];
|
|
1130
|
+
const matchesStdinIndex = arguments_.indexOf("--matches-json-stdin");
|
|
1131
|
+
if (arguments_[0] === "save-scan-comparison" &&
|
|
1132
|
+
matchesStdinIndex !== -1 &&
|
|
1133
|
+
input !== undefined) {
|
|
1134
|
+
const key = JSON.stringify([options.python, script]);
|
|
1135
|
+
let support = workbenchComparisonSupport.get(key);
|
|
1136
|
+
if (support === undefined) {
|
|
1137
|
+
const help = await run(["save-scan-comparison", "--help"]);
|
|
1138
|
+
options.signal?.throwIfAborted();
|
|
1139
|
+
support = {
|
|
1140
|
+
stdin: help.includes("--matches-json-stdin"),
|
|
1141
|
+
related: help
|
|
1142
|
+
.replace(/\s+/gu, " ")
|
|
1143
|
+
.includes("Comparison payload supports related findings."),
|
|
1144
|
+
};
|
|
1145
|
+
workbenchComparisonSupport.set(key, support);
|
|
1146
|
+
}
|
|
1147
|
+
const comparison = JSON.parse(input);
|
|
1148
|
+
if (isRecord(comparison) && "related" in comparison && !support.related) {
|
|
1149
|
+
delete comparison["related"];
|
|
1150
|
+
input = JSON.stringify(comparison);
|
|
1151
|
+
}
|
|
1152
|
+
if (!support.stdin) {
|
|
1153
|
+
arguments_.splice(matchesStdinIndex, 1, "--matches-json", input);
|
|
1154
|
+
input = undefined;
|
|
1155
|
+
}
|
|
1156
|
+
}
|
|
1157
|
+
stdout = await run(arguments_, input);
|
|
1132
1158
|
}
|
|
1133
1159
|
catch (error) {
|
|
1134
1160
|
if (options.signal?.aborted)
|
|
@@ -1749,6 +1775,15 @@ export function resolveCodexCommand(environment = process.env) {
|
|
|
1749
1775
|
}
|
|
1750
1776
|
return { command };
|
|
1751
1777
|
}
|
|
1778
|
+
export function executablePathForSpawn(command) {
|
|
1779
|
+
if (process.platform !== "win32" || !win32.isAbsolute(command))
|
|
1780
|
+
return command;
|
|
1781
|
+
// Root-relative paths still depend on the child's drive and working directory.
|
|
1782
|
+
const root = win32.parse(command).root;
|
|
1783
|
+
return root === "\\" || root === "/"
|
|
1784
|
+
? command
|
|
1785
|
+
: win32.toNamespacedPath(command);
|
|
1786
|
+
}
|
|
1752
1787
|
export async function bootstrapPlugin(codexHome, pluginRoot, options = {}) {
|
|
1753
1788
|
const root = await realpath(pluginRoot);
|
|
1754
1789
|
const { name, version } = await pluginMetadata(root);
|
|
@@ -1903,7 +1938,7 @@ export async function cleanupSdkDirectory(path) {
|
|
|
1903
1938
|
await rm(path, { recursive: true, force: true });
|
|
1904
1939
|
}
|
|
1905
1940
|
export async function runCodexCommand(command, args, environment, input, signal) {
|
|
1906
|
-
const child = spawn(command.command, [...args], {
|
|
1941
|
+
const child = spawn(executablePathForSpawn(command.command), [...args], {
|
|
1907
1942
|
env: environment,
|
|
1908
1943
|
stdio: ["pipe", "pipe", "pipe"],
|
|
1909
1944
|
windowsHide: true,
|