@openai/codex-security 0.8.0 → 0.8.2
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 +16 -10
- package/_bundled_plugin/.codex-plugin/plugin.json +1 -0
- package/_bundled_plugin/mcp/helpers.mjs.br.part-000 +0 -0
- package/_bundled_plugin/mcp/helpers.mjs.br.part-001 +0 -0
- package/_bundled_plugin/mcp/native/THIRD_PARTY_NOTICES.txt +4 -4
- package/_bundled_plugin/mcp/native/darwin-arm64/unix.node +0 -0
- package/_bundled_plugin/mcp/native/darwin-x64/unix.node +0 -0
- package/_bundled_plugin/mcp/native/linux-arm64-gnu/unix.node +0 -0
- package/_bundled_plugin/mcp/native/linux-arm64-musl/unix.node +0 -0
- package/_bundled_plugin/mcp/native/linux-x64-gnu/unix.node +0 -0
- package/_bundled_plugin/mcp/native/linux-x64-musl/unix.node +0 -0
- package/_bundled_plugin/mcp/native/win32-arm64/windows.node +0 -0
- package/_bundled_plugin/mcp/native/win32-x64/windows.node +0 -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/mcp/server.mjs.br.part-002 +0 -0
- package/_bundled_plugin/references/scan-artifacts.md +1 -1
- package/_bundled_plugin/scripts/finalize_scan_contract.py +37 -1
- package/_bundled_plugin/scripts/servicenow_avit.py +107 -0
- package/_bundled_plugin/scripts/workbench_coverage_receipts.py +0 -17
- package/_bundled_plugin/scripts/workbench_db.py +1 -3
- package/_bundled_plugin/scripts/workbench_saved_results.py +0 -66
- package/_bundled_plugin/scripts/workbench_scan_start.py +4 -1
- package/_bundled_plugin/scripts/workbench_target.py +0 -108
- package/_bundled_plugin/skills/publish-findings/SKILL.md +9 -3
- package/_bundled_plugin/skills/resolve-dependency-alert/SKILL.md +18 -0
- package/_bundled_plugin/skills/resolve-dependency-alert/agents/openai.yaml +4 -0
- package/_bundled_plugin/skills/security-scan/SKILL.md +1 -1
- package/_bundled_plugin/skills/threat-model-visualize/SKILL.md +83 -0
- package/_bundled_plugin/skills/threat-model-visualize/agents/openai.yaml +4 -0
- package/_bundled_plugin/skills/threat-model-visualize/assets/context-reference-overview.svg +366 -0
- package/_bundled_plugin/skills/threat-model-visualize/assets/context-reference-path.svg +558 -0
- package/_bundled_plugin/skills/threat-model-visualize/assets/control-effects.js +85 -0
- package/_bundled_plugin/skills/threat-model-visualize/assets/explorer.css +17 -0
- package/_bundled_plugin/skills/threat-model-visualize/assets/explorer.html +38 -0
- package/_bundled_plugin/skills/threat-model-visualize/assets/explorer.js +372 -0
- package/_bundled_plugin/skills/threat-model-visualize/assets/route-paths.js +71 -0
- package/_bundled_plugin/skills/threat-model-visualize/assets/source-roles.js +47 -0
- package/_bundled_plugin/skills/threat-model-visualize/assets/svg-layout.js +149 -0
- package/_bundled_plugin/skills/threat-model-visualize/references/context-explorer.md +21 -0
- package/_bundled_plugin/skills/threat-model-visualize/references/view-model.md +49 -0
- package/_bundled_plugin/skills/threat-model-visualize/scripts/build_explorer.py +563 -0
- package/dist/api.d.ts.map +1 -1
- package/dist/api.js +36 -15
- package/dist/api.js.map +1 -1
- package/dist/artifact-export.d.ts +12 -3
- package/dist/artifact-export.d.ts.map +1 -1
- package/dist/artifact-export.js +30 -10
- package/dist/artifact-export.js.map +1 -1
- package/dist/auth.js +1 -1
- package/dist/auth.js.map +1 -1
- package/dist/cli-help.d.ts.map +1 -1
- package/dist/cli-help.js +1 -0
- package/dist/cli-help.js.map +1 -1
- package/dist/cli.d.ts +1 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +72 -50
- package/dist/cli.js.map +1 -1
- package/dist/contract.d.ts +1 -0
- package/dist/contract.d.ts.map +1 -1
- package/dist/contract.js +16 -12
- package/dist/contract.js.map +1 -1
- package/dist/custom-validation-prompt.d.ts.map +1 -1
- package/dist/custom-validation-prompt.js +12 -4
- package/dist/custom-validation-prompt.js.map +1 -1
- package/dist/custom-validation.js +2 -2
- package/dist/custom-validation.js.map +1 -1
- package/dist/deduplication/deduplication-reviewer.d.ts.map +1 -1
- package/dist/deduplication/deduplication-reviewer.js +1 -1
- package/dist/deduplication/deduplication-reviewer.js.map +1 -1
- package/dist/deduplication/records-protocol.d.ts.map +1 -1
- package/dist/deduplication/records-protocol.js +36 -22
- package/dist/deduplication/records-protocol.js.map +1 -1
- package/dist/deduplication/records.d.ts +3 -1
- package/dist/deduplication/records.d.ts.map +1 -1
- package/dist/deduplication/records.js +12 -8
- package/dist/deduplication/records.js.map +1 -1
- package/dist/endor-findings.d.ts.map +1 -1
- package/dist/endor-findings.js +46 -61
- package/dist/endor-findings.js.map +1 -1
- package/dist/external-findings-import.d.ts.map +1 -1
- package/dist/external-findings-import.js +8 -6
- package/dist/external-findings-import.js.map +1 -1
- package/dist/external-findings-local.d.ts +3 -1
- package/dist/external-findings-local.d.ts.map +1 -1
- package/dist/external-findings-local.js +136 -36
- package/dist/external-findings-local.js.map +1 -1
- package/dist/external-findings-publish.d.ts +3 -1
- package/dist/external-findings-publish.d.ts.map +1 -1
- package/dist/external-findings-publish.js +56 -31
- package/dist/external-findings-publish.js.map +1 -1
- package/dist/external-findings-read.d.ts +2 -0
- package/dist/external-findings-read.d.ts.map +1 -1
- package/dist/external-findings-read.js +9 -0
- package/dist/external-findings-read.js.map +1 -1
- package/dist/external-findings.d.ts +11 -0
- package/dist/external-findings.d.ts.map +1 -1
- package/dist/external-findings.js +13 -1
- package/dist/external-findings.js.map +1 -1
- package/dist/external-import-models.d.ts +1 -1
- package/dist/external-import-models.d.ts.map +1 -1
- package/dist/external-import-models.js.map +1 -1
- package/dist/github-advisories.d.ts.map +1 -1
- package/dist/github-advisories.js +5 -5
- package/dist/github-advisories.js.map +1 -1
- package/dist/github-dependabot-findings.d.ts +6 -0
- package/dist/github-dependabot-findings.d.ts.map +1 -0
- package/dist/github-dependabot-findings.js +247 -0
- package/dist/github-dependabot-findings.js.map +1 -0
- package/dist/github-findings.d.ts.map +1 -1
- package/dist/github-findings.js +11 -4
- package/dist/github-findings.js.map +1 -1
- package/dist/github-identifiers.d.ts +4 -0
- package/dist/github-identifiers.d.ts.map +1 -0
- package/dist/github-identifiers.js +9 -0
- package/dist/github-identifiers.js.map +1 -0
- package/dist/github.d.ts.map +1 -1
- package/dist/github.js +4 -6
- package/dist/github.js.map +1 -1
- package/dist/host-protocol.d.ts +5 -0
- package/dist/host-protocol.d.ts.map +1 -1
- package/dist/host-protocol.js +27 -3
- package/dist/host-protocol.js.map +1 -1
- package/dist/hosted-scan.d.ts.map +1 -1
- package/dist/hosted-scan.js +13 -5
- package/dist/hosted-scan.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/inspector-findings.d.ts +9 -0
- package/dist/inspector-findings.d.ts.map +1 -0
- package/dist/inspector-findings.js +517 -0
- package/dist/inspector-findings.js.map +1 -0
- package/dist/patch-tui.d.ts +1 -1
- package/dist/patch-tui.d.ts.map +1 -1
- package/dist/patch-tui.js +4 -1
- package/dist/patch-tui.js.map +1 -1
- package/dist/runtime.d.ts +3 -2
- package/dist/runtime.d.ts.map +1 -1
- package/dist/runtime.js +15 -5
- package/dist/runtime.js.map +1 -1
- package/dist/scan-dashboard.d.ts.map +1 -1
- package/dist/scan-dashboard.js +25 -15
- package/dist/scan-dashboard.js.map +1 -1
- package/dist/scanner-import.d.ts +6 -2
- package/dist/scanner-import.d.ts.map +1 -1
- package/dist/scanner-import.js +23 -14
- package/dist/scanner-import.js.map +1 -1
- package/dist/semgrep-findings.d.ts.map +1 -1
- package/dist/semgrep-findings.js +39 -49
- package/dist/semgrep-findings.js.map +1 -1
- package/dist/snyk-findings.d.ts.map +1 -1
- package/dist/snyk-findings.js +78 -88
- package/dist/snyk-findings.js.map +1 -1
- package/docs/cli.md +52 -14
- package/docs/dedupe-records.md +17 -4
- package/docs/hosted-scans.md +14 -0
- package/package.json +5 -5
- package/schemas/external-findings.schema.json +1 -1
package/dist/api.js
CHANGED
|
@@ -55,7 +55,7 @@ import { CODEX_SECURITY_THREAD_SOURCES } from "./thread-source.js";
|
|
|
55
55
|
import { codexSecurityRequestContext } from "./request-metadata.js";
|
|
56
56
|
import { CODEX_EXECUTABLE_VERSION, CODEX_SDK_VERSION } from "./version.js";
|
|
57
57
|
import { bundledCodexSdkEnvironment } from "./codex-sdk-environment.js";
|
|
58
|
-
import { canonicalConfigPath, acquireCodexSecurityCredentialHomeLock, withCredentialHomeLock, bootstrapPlugin, bundledPluginRoot, cleanupSdkDirectory, codexSecurityCredentialAllowsAmbientImport, codexSecurityCredentialHome, codexSecurityHasStoredFileCredentials, codexSecurityStateDirectory, codexExecutableReadPaths, createIsolatedHome, executablePathForSpawn, expandHome, importAmbientAuth, prepareCodexSecurityCredentialHome, preserveCodexSecurityPluginRegistration, pluginExecutionEnvironment, environmentWithGit, pluginMetadata, planOutputArchive, prepareScanArtifactRestorer, prepareOutputDir, prepareScanRegistrationOutput, preparePersistentOutputRoot, probeCodexSandbox, requireModelSafeOutputDir, requireOutputOutsideRepositories, requireOutputOutsideRepository, requirePrivateCredentialHome,
|
|
58
|
+
import { canonicalConfigPath, acquireCodexSecurityCredentialHomeLock, withCredentialHomeLock, bootstrapPlugin, bundledPluginRoot, cleanupSdkDirectory, codexSecurityCredentialAllowsAmbientImport, codexSecurityCredentialHome, codexSecurityHasStoredFileCredentials, codexSecurityStateDirectory, codexExecutableReadPaths, createIsolatedHome, executablePathForSpawn, expandHome, importAmbientAuth, prepareCodexSecurityCredentialHome, preserveCodexSecurityPluginRegistration, pluginExecutionEnvironment, environmentWithGit, pluginMetadata, planOutputArchive, prepareScanArtifactRestorer, prepareOutputDir, prepareScanRegistrationOutput, preparePersistentOutputRoot, probeCodexSandbox, requireModelSafeOutputDir, requireOutputOutsideRepositories, requireOutputOutsideRepository, requirePrivateCredentialHome, preparePolicyOutputDirectory, resolveCodexCommand, resolvePluginPath, resolvePluginPython, runWorkbench, setCodexSecurityCredentialLogout, validateOutputDir, } from "./runtime.js";
|
|
59
59
|
import { enclosingGitWorktreeRoot, normalizeRepository, normalizeTarget, gitMarkerRoot, repositoryRevision, resolveRepositoryPath, validatedGitEnvironment, validateCommittedDiffCheckout, validateMode, } from "./targets.js";
|
|
60
60
|
import { inspectTrustedExecutable, isWithin, } from "./trusted-executable.js";
|
|
61
61
|
const DEEP_SCAN_CONFIG_PATH_ENVIRONMENT = "CODEX_SECURITY_DEEP_SCAN_CONFIG_PATH";
|
|
@@ -863,8 +863,8 @@ export class CodexSecurity {
|
|
|
863
863
|
outputDir = await (this.#dependencies.prepareOutputDir ?? prepareOutputDir)(inputs.outputDir ?? undefined, `${basename(target.repository)}-policy`, root, (path) => requireOutputOutsideRepositories(inputs.protectedRoots, path));
|
|
864
864
|
requireOutputOutsideRepositories(inputs.protectedRoots, outputDir);
|
|
865
865
|
requireModelSafeOutputDir(outputDir);
|
|
866
|
-
await (this.#dependencies.
|
|
867
|
-
|
|
866
|
+
await (this.#dependencies.preparePolicyOutputDirectory ??
|
|
867
|
+
preparePolicyOutputDirectory)(outputDir);
|
|
868
868
|
if (options.knowledgeBasePaths?.length) {
|
|
869
869
|
knowledgeBase = await prepareKnowledgeBase(options.knowledgeBasePaths, signal, outputDir);
|
|
870
870
|
}
|
|
@@ -1600,7 +1600,7 @@ export class CodexSecurity {
|
|
|
1600
1600
|
await writeCustomValidationStatus(scanDir, { scanId, status: "pending" }, signal);
|
|
1601
1601
|
}
|
|
1602
1602
|
checkOpen();
|
|
1603
|
-
const basePrompt = scanPrompt(await targetInstruction(normalized, shellPluginRoot), mode, skillName, scanId, knowledgeBase !== null, options.resumeScanId !== undefined &&
|
|
1603
|
+
const basePrompt = scanPrompt(await targetInstruction(normalized, shellPluginRoot, this.#dependencies.hostedScan !== undefined), mode, skillName, scanId, knowledgeBase !== null, options.resumeScanId !== undefined &&
|
|
1604
1604
|
typeof registration["userContext"] === "string"
|
|
1605
1605
|
? registration["userContext"]
|
|
1606
1606
|
: options.scanPrompt, options.maxCostUsd !== undefined, discoveryPrompt, modelProvider, options.ownerSuggestions);
|
|
@@ -3421,7 +3421,7 @@ function skillNameFor(target, mode) {
|
|
|
3421
3421
|
return "security-diff-scan";
|
|
3422
3422
|
return mode === "deep" ? "deep-security-scan" : "security-scan";
|
|
3423
3423
|
}
|
|
3424
|
-
async function targetInstruction(target, pluginRoot) {
|
|
3424
|
+
async function targetInstruction(target, pluginRoot, hosted) {
|
|
3425
3425
|
if (target.kind === "repository")
|
|
3426
3426
|
return "Scan target: the entire repository.";
|
|
3427
3427
|
if (target.kind === "paths") {
|
|
@@ -3436,16 +3436,33 @@ async function targetInstruction(target, pluginRoot) {
|
|
|
3436
3436
|
if (code !== "ENOENT" && code !== "ENOTDIR")
|
|
3437
3437
|
throw error;
|
|
3438
3438
|
}
|
|
3439
|
-
const
|
|
3440
|
-
|
|
3441
|
-
: process.platform === "win32"
|
|
3442
|
-
? String.raw `cmd.exe /d /v:off /s /c '""%CODEX_SECURITY_PLUGIN_ROOT%\scripts\launch_codex_security_mcp.cmd" --helper make-repo-scope-input --repo "%CODEX_SECURITY_REPOSITORY%\." --scopes-file "%CODEX_SECURITY_TARGET_PATHS_FILE%" --out "%CODEX_SECURITY_SCAN_DIR%\scoped-source-input.jsonl""'`
|
|
3443
|
-
: `${helper} --helper make-repo-scope-input --repo ${shellEnvironmentReference("CODEX_SECURITY_REPOSITORY")} --scopes-file ${scopes} --out ${shellEnvironmentReference("CODEX_SECURITY_SCAN_DIR", "/scoped-source-input.jsonl")}`;
|
|
3439
|
+
const inventory = shellEnvironmentReference("CODEX_SECURITY_SCAN_DIR", "/scoped-source-input.jsonl");
|
|
3440
|
+
const scopeArgs = `--repo ${shellEnvironmentReference("CODEX_SECURITY_REPOSITORY")} --scopes-file ${scopes} --out ${inventory}`;
|
|
3444
3441
|
// CMD expands the environment references once, preserving percent signs in path values.
|
|
3445
3442
|
const bindScopes = process.platform === "win32"
|
|
3446
3443
|
? String.raw `cmd.exe /d /v:off /s /c '""%CODEX_SECURITY_PLUGIN_ROOT%\scripts\launch_codex_security_mcp.cmd" --helper bind-repo-scopes --scopes-file "%CODEX_SECURITY_TARGET_PATHS_FILE%" --manifest "%CODEX_SECURITY_SCAN_DIR%\scan-manifest.json""'`
|
|
3447
|
-
: `${
|
|
3448
|
-
|
|
3444
|
+
: `${helper} --helper bind-repo-scopes --scopes-file ${scopes} --manifest ${shellEnvironmentReference("CODEX_SECURITY_SCAN_DIR", "/scan-manifest.json")}`;
|
|
3445
|
+
const scanTarget = "Scan target paths: resolve every requested file and all non-ignored descendants of requested directories";
|
|
3446
|
+
const finalize = `Before finalization, preserve every requested scope with:\n${bindScopes}\nDo not print, evaluate, or modify the target-paths file.`;
|
|
3447
|
+
if (hosted && process.platform === "linux" && !legacyGenerator) {
|
|
3448
|
+
const capabilities = await pluginCapabilities(pluginRoot).catch(() => undefined);
|
|
3449
|
+
if (capabilities?.["hostedScopeInventory"] === 1) {
|
|
3450
|
+
const hostedHelper = `${helper} --helper make-hosted-repo-scope-input ${scopeArgs}`;
|
|
3451
|
+
return [
|
|
3452
|
+
`${scanTarget} using the hosted scope helper:`,
|
|
3453
|
+
`${hostedHelper} --state-dir ${shellEnvironmentReference("CODEX_SECURITY_STATE_DIR")}`,
|
|
3454
|
+
"Use the reported path. If a later shell cannot read it, use the path reported by this recovery command:",
|
|
3455
|
+
hostedHelper,
|
|
3456
|
+
finalize,
|
|
3457
|
+
].join("\n");
|
|
3458
|
+
}
|
|
3459
|
+
}
|
|
3460
|
+
const makeScope = legacyGenerator
|
|
3461
|
+
? `${pluginPythonCommand()} ${shellEnvironmentReference("CODEX_SECURITY_PLUGIN_ROOT", "/scripts/generate_rank_input.py")} make-repo-scope-input ${scopeArgs}`
|
|
3462
|
+
: process.platform === "win32"
|
|
3463
|
+
? String.raw `cmd.exe /d /v:off /s /c '""%CODEX_SECURITY_PLUGIN_ROOT%\scripts\launch_codex_security_mcp.cmd" --helper make-repo-scope-input --repo "%CODEX_SECURITY_REPOSITORY%\." --scopes-file "%CODEX_SECURITY_TARGET_PATHS_FILE%" --out "%CODEX_SECURITY_SCAN_DIR%\scoped-source-input.jsonl""'`
|
|
3464
|
+
: `${helper} --helper make-repo-scope-input ${scopeArgs}`;
|
|
3465
|
+
return `${scanTarget} using ${makeScope}. ${finalize}`;
|
|
3449
3466
|
}
|
|
3450
3467
|
if (target.kind === "refs") {
|
|
3451
3468
|
return `Scan target: Git diff from ${target.base} to ${target.head}.`;
|
|
@@ -4075,13 +4092,17 @@ export function scanPreflightCodexConfig(config) {
|
|
|
4075
4092
|
}
|
|
4076
4093
|
return result;
|
|
4077
4094
|
}
|
|
4078
|
-
async function
|
|
4079
|
-
const manifest = JSON.parse(await readFile(join(
|
|
4095
|
+
async function pluginCapabilities(pluginRoot) {
|
|
4096
|
+
const manifest = JSON.parse(await readFile(join(pluginRoot, ".codex-plugin", "plugin.json"), "utf8"));
|
|
4080
4097
|
const capabilities = isRecord(manifest)
|
|
4081
4098
|
? manifest["codexSecurity"]
|
|
4082
4099
|
: undefined;
|
|
4100
|
+
return isRecord(capabilities) ? capabilities : undefined;
|
|
4101
|
+
}
|
|
4102
|
+
async function requireCurrentDeepScanPlugin(runtime) {
|
|
4103
|
+
const capabilities = await pluginCapabilities(runtime.plugin.pluginRoot);
|
|
4083
4104
|
if (runtime.deepScanConfigPath === undefined ||
|
|
4084
|
-
|
|
4105
|
+
capabilities === undefined ||
|
|
4085
4106
|
capabilities["directDeepScanEngine"] !== 1 ||
|
|
4086
4107
|
capabilities["workerProviderSnapshot"] !== 4) {
|
|
4087
4108
|
throw new CodexSecurityError("Deep Scan requires the current plugin's direct engine and isolated worker runtime support. Update the custom plugin or use the bundled plugin.");
|