@openai/codex-security 0.4.0 → 0.5.0
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 +45 -9
- package/_bundled_plugin/.mcp.json +1 -0
- package/_bundled_plugin/mcp/helpers.mjs.br.part-000 +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/references/core-scan.md +2 -0
- package/_bundled_plugin/references/final-report.md +5 -1
- package/_bundled_plugin/references/investigation-time-budget.md +11 -0
- package/_bundled_plugin/references/sarif-adapter.md +1 -0
- package/_bundled_plugin/references/scan-prologue.md +2 -6
- package/_bundled_plugin/references/scan-runtime.md +15 -0
- package/_bundled_plugin/references/threat-model.md +2 -0
- package/_bundled_plugin/schemas/definitions/artifact-common.schema.json +5 -1
- package/_bundled_plugin/scripts/deep_scan_workbench.py +7 -0
- package/_bundled_plugin/scripts/finalize_scan_contract.py +80 -43
- package/_bundled_plugin/scripts/finding_preview.py +5 -3
- package/_bundled_plugin/scripts/generate_rank_input.py +1 -0
- package/_bundled_plugin/scripts/launch_codex_security_mcp +39 -4
- package/_bundled_plugin/scripts/snapshot_sqlite.py +7 -0
- package/_bundled_plugin/scripts/windows_scan_local_files.py +43 -1
- package/_bundled_plugin/scripts/workbench_cli.py +0 -3
- package/_bundled_plugin/scripts/workbench_constants.py +4 -0
- package/_bundled_plugin/scripts/workbench_db.py +56 -33
- package/_bundled_plugin/scripts/workbench_progress.py +0 -50
- package/_bundled_plugin/scripts/workbench_scan_history.py +3 -2
- package/_bundled_plugin/scripts/workbench_scan_start.py +12 -4
- package/_bundled_plugin/scripts/workbench_scan_usage.py +190 -30
- package/_bundled_plugin/scripts/workbench_schema.py +1 -1
- package/_bundled_plugin/scripts/workbench_source_excerpt.py +74 -51
- package/_bundled_plugin/scripts/workbench_source_scopes.py +388 -0
- package/_bundled_plugin/scripts/workbench_target.py +7 -5
- package/_bundled_plugin/scripts/workbench_validation.py +37 -1
- package/_bundled_plugin/shared/workbench-history-repairs.json +19 -0
- package/_bundled_plugin/shared/workbench-migrations.json +5 -0
- package/_bundled_plugin/skills/deep-security-scan/SKILL.md +1 -1
- package/_bundled_plugin/skills/security-diff-scan/SKILL.md +4 -2
- package/_bundled_plugin/skills/security-scan/SKILL.md +3 -1
- package/_bundled_plugin/skills/security-scan/references/desktop-scan.md +2 -2
- package/dist/api.d.ts +3 -2
- package/dist/api.d.ts.map +1 -1
- package/dist/api.js +54 -36
- package/dist/api.js.map +1 -1
- package/dist/artifact-export.d.ts +2 -1
- package/dist/artifact-export.d.ts.map +1 -1
- package/dist/artifact-export.js +38 -23
- package/dist/artifact-export.js.map +1 -1
- package/dist/classify-severity-records.d.ts +76 -0
- package/dist/classify-severity-records.d.ts.map +1 -0
- package/dist/classify-severity-records.js +141 -0
- package/dist/classify-severity-records.js.map +1 -0
- package/dist/classify-severity.d.ts +1 -23
- package/dist/classify-severity.d.ts.map +1 -1
- package/dist/classify-severity.js +3 -24
- package/dist/classify-severity.js.map +1 -1
- package/dist/cli-help.d.ts.map +1 -1
- package/dist/cli-help.js +2 -0
- package/dist/cli-help.js.map +1 -1
- package/dist/cli.d.ts +4 -2
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +136 -147
- package/dist/cli.js.map +1 -1
- package/dist/cloud-publish.js +1 -1
- package/dist/cloud-publish.js.map +1 -1
- package/dist/codex-sdk-environment.js +1 -1
- package/dist/codex-sdk-environment.js.map +1 -1
- package/dist/config.d.ts +12 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +10 -4
- package/dist/config.js.map +1 -1
- package/dist/contract.d.ts +5 -0
- package/dist/contract.d.ts.map +1 -1
- package/dist/contract.js +65 -17
- package/dist/contract.js.map +1 -1
- package/dist/cost-model.d.ts.map +1 -1
- package/dist/cost-model.js +7 -2
- package/dist/cost-model.js.map +1 -1
- package/dist/custom-validation-prompt.js +3 -3
- package/dist/custom-validation-prompt.js.map +1 -1
- package/dist/deduplication/deduplication-prompts.d.ts +1 -1
- package/dist/deduplication/deduplication-prompts.d.ts.map +1 -1
- package/dist/deduplication/deduplication-prompts.js +2 -2
- package/dist/deduplication/deduplication-prompts.js.map +1 -1
- package/dist/deduplication/records.js +1 -1
- package/dist/deduplication/records.js.map +1 -1
- package/dist/deduplication/scan.d.ts.map +1 -1
- package/dist/deduplication/scan.js +10 -9
- package/dist/deduplication/scan.js.map +1 -1
- package/dist/deep-config.d.ts +4 -1
- package/dist/deep-config.d.ts.map +1 -1
- package/dist/deep-config.js +21 -1
- package/dist/deep-config.js.map +1 -1
- package/dist/findings-import.d.ts +1 -1
- package/dist/findings-import.d.ts.map +1 -1
- package/dist/findings-import.js +3 -3
- package/dist/findings-import.js.map +1 -1
- package/dist/git-remote.d.ts +10 -0
- package/dist/git-remote.d.ts.map +1 -0
- package/dist/git-remote.js +24 -0
- package/dist/git-remote.js.map +1 -0
- package/dist/github.d.ts.map +1 -1
- package/dist/github.js +5 -7
- package/dist/github.js.map +1 -1
- package/dist/host-protocol.js +1 -1
- package/dist/host-protocol.js.map +1 -1
- package/dist/host-records-protocol.d.ts +15 -0
- package/dist/host-records-protocol.d.ts.map +1 -0
- package/dist/host-records-protocol.js +15 -0
- package/dist/host-records-protocol.js.map +1 -0
- package/dist/hosted-scan.d.ts +1 -6
- package/dist/hosted-scan.d.ts.map +1 -1
- package/dist/hosted-scan.js +2 -2
- package/dist/hosted-scan.js.map +1 -1
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/knowledge-base.d.ts.map +1 -1
- package/dist/knowledge-base.js +87 -7
- package/dist/knowledge-base.js.map +1 -1
- package/dist/multiscan.d.ts.map +1 -1
- package/dist/multiscan.js +62 -28
- package/dist/multiscan.js.map +1 -1
- package/dist/patch-publication.d.ts +26 -0
- package/dist/patch-publication.d.ts.map +1 -0
- package/dist/patch-publication.js +105 -0
- package/dist/patch-publication.js.map +1 -0
- 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/project-config-schema.d.ts +2 -0
- package/dist/project-config-schema.d.ts.map +1 -1
- package/dist/project-config-schema.js +1 -0
- package/dist/project-config-schema.js.map +1 -1
- package/dist/project-config.d.ts +1 -0
- package/dist/project-config.d.ts.map +1 -1
- package/dist/project-config.js +16 -6
- package/dist/project-config.js.map +1 -1
- package/dist/publication.d.ts.map +1 -1
- package/dist/publication.js +135 -19
- package/dist/publication.js.map +1 -1
- package/dist/publish.d.ts.map +1 -1
- package/dist/publish.js +39 -25
- package/dist/publish.js.map +1 -1
- package/dist/runtime.d.ts.map +1 -1
- package/dist/runtime.js +83 -22
- package/dist/runtime.js.map +1 -1
- package/dist/scan-settings.d.ts +1 -0
- package/dist/scan-settings.d.ts.map +1 -1
- package/dist/scan-settings.js +7 -1
- package/dist/scan-settings.js.map +1 -1
- package/dist/scan-time-budget.d.ts +9 -0
- package/dist/scan-time-budget.d.ts.map +1 -0
- package/dist/scan-time-budget.js +16 -0
- package/dist/scan-time-budget.js.map +1 -0
- package/dist/severity-review.d.ts +29 -0
- package/dist/severity-review.d.ts.map +1 -0
- package/dist/severity-review.js +47 -0
- package/dist/severity-review.js.map +1 -0
- package/dist/validation-records.d.ts +38 -0
- package/dist/validation-records.d.ts.map +1 -0
- package/dist/validation-records.js +76 -0
- package/dist/validation-records.js.map +1 -0
- package/dist/version.d.ts.map +1 -1
- package/dist/version.js +4 -2
- package/dist/version.js.map +1 -1
- package/dist/worker-progress.d.ts +2 -6
- package/dist/worker-progress.d.ts.map +1 -1
- package/dist/worker-progress.js +1 -43
- package/dist/worker-progress.js.map +1 -1
- package/docs/classify-severity-records.md +89 -0
- package/docs/cli.md +269 -33
- package/docs/validate-records.md +69 -0
- package/package.json +12 -10
- package/schemas/project-config.schema.json +7 -1
- package/_bundled_plugin/preflight/capability-profiles.toml +0 -76
- package/_bundled_plugin/references/config-preflight.md +0 -93
- package/_bundled_plugin/references/desktop-config-preflight.md +0 -11
- package/_bundled_plugin/scripts/config_preflight.py +0 -911
package/dist/api.js
CHANGED
|
@@ -32,6 +32,7 @@ import { runDeepScan } from "./deep-scan.js";
|
|
|
32
32
|
import { deepScanOptions, resolveDeepScanConfig, writeDeepScanConfig, } from "./deep-config.js";
|
|
33
33
|
import { DEFAULT_SCAN_AUTH, DEFAULT_SCAN_MODE, SCAN_AUTH_MODES, ScanSettingsSchema, } from "./scan-settings.js";
|
|
34
34
|
import { resolveScanPrompts } from "./prompt-files.js";
|
|
35
|
+
import { readScanTimeBudgetPolicy, renderScanTimeBudgetPolicy, scanTimeBudget, } from "./scan-time-budget.js";
|
|
35
36
|
import { standaloneValidationPrompt } from "./standalone-validation-prompt.js";
|
|
36
37
|
export { SCAN_AUTH_MODES } from "./scan-settings.js";
|
|
37
38
|
import { loadContract, readScanFile, requireScanFile, } from "./contract.js";
|
|
@@ -509,12 +510,19 @@ export class CodexSecurity {
|
|
|
509
510
|
: {}),
|
|
510
511
|
outputDir: inputs.outputDir,
|
|
511
512
|
...(archiveDir === null ? {} : { archiveDir }),
|
|
512
|
-
authentication: scanAuthentication(this.#dependencies.environment, options.auth, modelProvider, hasCommandAuth(configuration)),
|
|
513
|
+
authentication: scanAuthentication(this.#dependencies.environment, options.auth, modelProvider, hasCommandAuth(configuration), true),
|
|
513
514
|
...model,
|
|
514
515
|
...(typeof modelProvider === "string" ? { modelProvider } : {}),
|
|
515
516
|
...(options.maxCostUsd === undefined
|
|
516
517
|
? {}
|
|
517
518
|
: { maxCostUsd: options.maxCostUsd }),
|
|
519
|
+
...(inputs.deepScanConfiguration !== undefined
|
|
520
|
+
? {
|
|
521
|
+
maxTimeMinutes: inputs.deepScanConfiguration.settings.maxTimeHours * 60,
|
|
522
|
+
}
|
|
523
|
+
: options.maxTimeMinutes === undefined
|
|
524
|
+
? {}
|
|
525
|
+
: { maxTimeMinutes: options.maxTimeMinutes }),
|
|
518
526
|
};
|
|
519
527
|
}
|
|
520
528
|
async preflightPolicy(repository, options = {}) {
|
|
@@ -899,6 +907,10 @@ export class CodexSecurity {
|
|
|
899
907
|
}),
|
|
900
908
|
};
|
|
901
909
|
const { environment: workerEnvironment, ...workerRuntimeConfig } = selectedWorkerRuntimeConfig(effectiveConfig, modelProvider, scanDir, workerProviderEnvironment);
|
|
910
|
+
const sqliteHome = workerRuntimeConfig["sqlite_home"];
|
|
911
|
+
const sqliteEnvironment = mode === "deep" && typeof sqliteHome === "string"
|
|
912
|
+
? { CODEX_SQLITE_HOME: sqliteHome }
|
|
913
|
+
: {};
|
|
902
914
|
const workerSnapshot = {
|
|
903
915
|
...workerRuntimeConfig,
|
|
904
916
|
responses_api_metadata: {
|
|
@@ -1083,6 +1095,7 @@ export class CodexSecurity {
|
|
|
1083
1095
|
knowledgeBasePaths: knowledgeBase?.sources,
|
|
1084
1096
|
maxCostUsd: options.maxCostUsd,
|
|
1085
1097
|
deepScan: deepScanConfiguration?.settings,
|
|
1098
|
+
maxTimeMinutes: options.maxTimeMinutes,
|
|
1086
1099
|
auth: options.auth,
|
|
1087
1100
|
cyberAccessProgram: options.cyberAccessProgram,
|
|
1088
1101
|
});
|
|
@@ -1100,6 +1113,7 @@ export class CodexSecurity {
|
|
|
1100
1113
|
pluginRoot: runtime.plugin.pluginRoot,
|
|
1101
1114
|
environment: {
|
|
1102
1115
|
...environmentWithGit(git.environment, git),
|
|
1116
|
+
...sqliteEnvironment,
|
|
1103
1117
|
CODEX_SECURITY_STATE_DIR: stateDirectory,
|
|
1104
1118
|
},
|
|
1105
1119
|
signal,
|
|
@@ -1245,7 +1259,7 @@ export class CodexSecurity {
|
|
|
1245
1259
|
await writeCustomValidationStatus(scanDir, { scanId, status: "pending" }, signal);
|
|
1246
1260
|
}
|
|
1247
1261
|
checkOpen();
|
|
1248
|
-
const basePrompt = scanPrompt(normalized, mode, skillName, scanId,
|
|
1262
|
+
const basePrompt = scanPrompt(normalized, mode, skillName, scanId, knowledgeBase !== null, options.resumeScanId !== undefined &&
|
|
1249
1263
|
typeof registration["userContext"] === "string"
|
|
1250
1264
|
? registration["userContext"]
|
|
1251
1265
|
: options.scanPrompt, options.maxCostUsd !== undefined, discoveryPrompt, modelProvider);
|
|
@@ -1289,6 +1303,7 @@ export class CodexSecurity {
|
|
|
1289
1303
|
? join(dirname(runtime.codexHome), `codex-security-target-paths-${randomUUID()}.json`)
|
|
1290
1304
|
: null;
|
|
1291
1305
|
const runtimePaths = {
|
|
1306
|
+
...sqliteEnvironment,
|
|
1292
1307
|
PYTHON: python,
|
|
1293
1308
|
CODEX_SECURITY_STARTED_AT: options.resumeScanId !== undefined &&
|
|
1294
1309
|
typeof registration["startedAt"] === "string"
|
|
@@ -1365,6 +1380,11 @@ export class CodexSecurity {
|
|
|
1365
1380
|
if (postScanPrompt?.trim()) {
|
|
1366
1381
|
runPostScan = () => thread.runStreamed(postScanPrompt, turnOptions);
|
|
1367
1382
|
}
|
|
1383
|
+
if (mode === "standard" && options.maxTimeMinutes !== undefined) {
|
|
1384
|
+
const timePolicy = await readScanTimeBudgetPolicy(runtime.plugin.pluginRoot);
|
|
1385
|
+
checkOpen();
|
|
1386
|
+
prompt += `\n\n${renderScanTimeBudgetPolicy(timePolicy, scanTimeBudget(options.maxTimeMinutes, (this.#dependencies.now ?? Date.now)()))}`;
|
|
1387
|
+
}
|
|
1368
1388
|
const events = directDeepScan
|
|
1369
1389
|
? (this.#dependencies.runDeepScan ?? runDeepScan)({
|
|
1370
1390
|
codexOptions,
|
|
@@ -1873,7 +1893,10 @@ export class CodexSecurity {
|
|
|
1873
1893
|
if (this.#closePromise !== null)
|
|
1874
1894
|
return await this.#closePromise;
|
|
1875
1895
|
this.#closed = true;
|
|
1876
|
-
|
|
1896
|
+
const completion = Promise.withResolvers();
|
|
1897
|
+
// Abort listeners can reenter close before finishClose reaches its first await.
|
|
1898
|
+
this.#closePromise = completion.promise;
|
|
1899
|
+
void this.#finishClose().then(completion.resolve, completion.reject);
|
|
1877
1900
|
await this.#closePromise;
|
|
1878
1901
|
}
|
|
1879
1902
|
async #finishClose() {
|
|
@@ -1940,15 +1963,16 @@ export class CodexSecurity {
|
|
|
1940
1963
|
if (this.#activeOperation !== null) {
|
|
1941
1964
|
throw new CodexSecurityError("A Codex Security operation is already in progress.");
|
|
1942
1965
|
}
|
|
1943
|
-
const activeOperation =
|
|
1944
|
-
this.#activeOperation = activeOperation;
|
|
1966
|
+
const activeOperation = Promise.withResolvers();
|
|
1967
|
+
this.#activeOperation = activeOperation.promise;
|
|
1945
1968
|
try {
|
|
1946
|
-
return await
|
|
1969
|
+
return await operation();
|
|
1947
1970
|
}
|
|
1948
1971
|
finally {
|
|
1949
|
-
if (this.#activeOperation === activeOperation) {
|
|
1972
|
+
if (this.#activeOperation === activeOperation.promise) {
|
|
1950
1973
|
this.#activeOperation = null;
|
|
1951
1974
|
}
|
|
1975
|
+
activeOperation.resolve();
|
|
1952
1976
|
}
|
|
1953
1977
|
}
|
|
1954
1978
|
async #createSessionCodex(session, command, runtimePaths, auth = "auto", git, config, configOverrides = []) {
|
|
@@ -2424,6 +2448,7 @@ export class CodexSecurity {
|
|
|
2424
2448
|
failOnSeverity: options.failureSeverity,
|
|
2425
2449
|
knowledgeBasePaths: options.knowledgeBasePaths,
|
|
2426
2450
|
maxCostUsd: options.maxCostUsd,
|
|
2451
|
+
maxTimeMinutes: options.maxTimeMinutes,
|
|
2427
2452
|
auth: options.auth,
|
|
2428
2453
|
cyberAccessProgram: options.cyberAccessProgram,
|
|
2429
2454
|
}),
|
|
@@ -2925,7 +2950,7 @@ function trustedAccessWarning(status, authentication) {
|
|
|
2925
2950
|
: "your Trusted Access for Cyber status";
|
|
2926
2951
|
return `Some cybersecurity requests or findings may be refused because ${access} could not be verified. Check ${apiOrganization ? "your organization's access" : "your access"} or apply at ${applicationUrl}.`;
|
|
2927
2952
|
}
|
|
2928
|
-
function scanPrompt(target, mode, skillName, scanId,
|
|
2953
|
+
function scanPrompt(target, mode, skillName, scanId, hasKnowledgeBase = false, additionalPrompt, enforceCostLimit = false, discoveryPrompt, modelProvider) {
|
|
2929
2954
|
const python = pluginPythonCommand();
|
|
2930
2955
|
const customValidation = discoveryPrompt !== undefined;
|
|
2931
2956
|
return [
|
|
@@ -2978,11 +3003,6 @@ function scanPrompt(target, mode, skillName, scanId, hasConfigPath = false, hasK
|
|
|
2978
3003
|
'After the file inventory, after each fully reviewed file batch, and when entering each later phase, emit one standalone CODEX_SECURITY_SCAN_PROGRESS {"phase":"discovery","filesCompleted":3,"filesTotal":8} line in a completed command output or agent message. Use the actual phase and file counts. Never count unread or partially reviewed files.',
|
|
2979
3004
|
'Every delegated review assignment must say: After each completed batch, emit CODEX_SECURITY_SCAN_PROGRESS {"phase":"discovery","filesCompleted":3,"filesTotal":8} on its own line using your worker-local reviewed and assigned file counts.',
|
|
2980
3005
|
]),
|
|
2981
|
-
...(hasConfigPath
|
|
2982
|
-
? [
|
|
2983
|
-
`For normal config-preflight helper calls, append --config ${shellEnvironmentReference("CODEX_SECURITY_CONFIG_PATH")} so preflight reads the sanitized active runtime config. Preserve the documented runtime and --effective-config arguments for session-only values.`,
|
|
2984
|
-
]
|
|
2985
|
-
: []),
|
|
2986
3006
|
...(hasKnowledgeBase
|
|
2987
3007
|
? [
|
|
2988
3008
|
`The ${shellEnvironmentReference("CODEX_SECURITY_KNOWLEDGE_BASE")} environment variable contains primary documents about the project and its organization, including their architecture, threat model, and policies. These documents are a source of truth and override conflicting SECURITY.md guidance, generated threat models, and other sources, except explicit user instructions.`,
|
|
@@ -3034,7 +3054,7 @@ function targetInstruction(target, python) {
|
|
|
3034
3054
|
}
|
|
3035
3055
|
return `Scan target: staged and unstaged working-tree changes against ${target.base}.`;
|
|
3036
3056
|
}
|
|
3037
|
-
function scanRecipe({ repository, target, mode, repositoryRevision, pluginVersion, config, failOnSeverity, knowledgeBasePaths, maxCostUsd, deepScan, auth, cyberAccessProgram, }) {
|
|
3057
|
+
function scanRecipe({ repository, target, mode, repositoryRevision, pluginVersion, config, failOnSeverity, knowledgeBasePaths, maxCostUsd, maxTimeMinutes, deepScan, auth, cyberAccessProgram, }) {
|
|
3038
3058
|
return {
|
|
3039
3059
|
repository,
|
|
3040
3060
|
target: { ...target, paths: [...target.paths] },
|
|
@@ -3047,6 +3067,7 @@ function scanRecipe({ repository, target, mode, repositoryRevision, pluginVersio
|
|
|
3047
3067
|
...(failOnSeverity === undefined ? {} : { failOnSeverity }),
|
|
3048
3068
|
...(knowledgeBasePaths === undefined ? {} : { knowledgeBasePaths }),
|
|
3049
3069
|
...(maxCostUsd === undefined ? {} : { maxCostUsd }),
|
|
3070
|
+
...(maxTimeMinutes === undefined ? {} : { maxTimeMinutes }),
|
|
3050
3071
|
...(deepScan === undefined
|
|
3051
3072
|
? {}
|
|
3052
3073
|
: { deepScan: { ...deepScan }, deepScanResolved: true }),
|
|
@@ -3144,7 +3165,7 @@ async function collectResult(turnResult, threadId, scanDir, pluginRoot, expectat
|
|
|
3144
3165
|
}),
|
|
3145
3166
|
});
|
|
3146
3167
|
}
|
|
3147
|
-
export function scanAuthentication(environment, auth = DEFAULT_SCAN_AUTH, modelProvider, commandAuth = false) {
|
|
3168
|
+
export function scanAuthentication(environment, auth = DEFAULT_SCAN_AUTH, modelProvider, commandAuth = false, preflight = false) {
|
|
3148
3169
|
if (!SCAN_AUTH_MODES.includes(auth)) {
|
|
3149
3170
|
throw new TypeError("Scan authentication mode must be auto, chatgpt, or api-key.");
|
|
3150
3171
|
}
|
|
@@ -3172,6 +3193,9 @@ export function scanAuthentication(environment, auth = DEFAULT_SCAN_AUTH, modelP
|
|
|
3172
3193
|
const key = environmentApiKeyEntry(environment, modelProvider);
|
|
3173
3194
|
if (key === null && isExternalModelProvider(modelProvider)) {
|
|
3174
3195
|
const provider = EXTERNAL_CODEX_PROVIDERS[modelProvider];
|
|
3196
|
+
if (preflight && auth === "auto") {
|
|
3197
|
+
return { method: "api_key", source: provider.env_key, verified: false };
|
|
3198
|
+
}
|
|
3175
3199
|
throw new AuthenticationRequiredError(`Set ${provider.env_key} to run a scan through ${provider.name}.`);
|
|
3176
3200
|
}
|
|
3177
3201
|
if (auth === "api-key" &&
|
|
@@ -3230,7 +3254,9 @@ export function selectedScanEnvironment(environment, auth = "auto", modelProvide
|
|
|
3230
3254
|
}
|
|
3231
3255
|
return Object.fromEntries(Object.entries(withoutOpenAiApiKeys(environment)).filter(([name]) => {
|
|
3232
3256
|
const key = name.toUpperCase();
|
|
3233
|
-
if (key === "OPENROUTER_API_KEY" ||
|
|
3257
|
+
if (key === "OPENROUTER_API_KEY" ||
|
|
3258
|
+
key === "FIREWORKS_API_KEY" ||
|
|
3259
|
+
key === "CHEAPER_INFERENCE_API_KEY") {
|
|
3234
3260
|
return (!bedrockProvider &&
|
|
3235
3261
|
(selectedProviderKey === null || key === selectedProviderKey));
|
|
3236
3262
|
}
|
|
@@ -3640,28 +3666,20 @@ function selectedWorkerRuntimeConfig(config, selectedProvider, workingDirectory,
|
|
|
3640
3666
|
const value = key === undefined ? undefined : environment[key];
|
|
3641
3667
|
return value === undefined ? [] : [[name, value]];
|
|
3642
3668
|
}));
|
|
3643
|
-
|
|
3644
|
-
|
|
3645
|
-
|
|
3669
|
+
// Workers use separate directories; preserve the parent scan's native paths.
|
|
3670
|
+
for (const key of [
|
|
3671
|
+
"model_instructions_file",
|
|
3672
|
+
"experimental_compact_prompt_file",
|
|
3673
|
+
"model_catalog_json",
|
|
3674
|
+
"sqlite_home",
|
|
3675
|
+
]) {
|
|
3676
|
+
const file = resolved[key];
|
|
3677
|
+
if (typeof file === "string") {
|
|
3678
|
+
resolved[key] = resolve(workingDirectory, expandHome(file, environment));
|
|
3679
|
+
}
|
|
3646
3680
|
}
|
|
3647
3681
|
return {
|
|
3648
|
-
...
|
|
3649
|
-
...CODEX_AUTH_CONFIG_KEYS,
|
|
3650
|
-
"analytics",
|
|
3651
|
-
"responses_api_metadata",
|
|
3652
|
-
"openai_base_url",
|
|
3653
|
-
"features",
|
|
3654
|
-
"model_auto_compact_token_limit",
|
|
3655
|
-
"model_context_window",
|
|
3656
|
-
"model_instructions_file",
|
|
3657
|
-
"model_verbosity",
|
|
3658
|
-
"shell_environment_policy",
|
|
3659
|
-
"skills",
|
|
3660
|
-
"web_search",
|
|
3661
|
-
"windows",
|
|
3662
|
-
]
|
|
3663
|
-
.filter((key) => resolved[key] !== undefined)
|
|
3664
|
-
.map((key) => [key, resolved[key]])),
|
|
3682
|
+
...structuredCodexConfig(resolved),
|
|
3665
3683
|
...(provider === undefined ? {} : { model_provider: provider }),
|
|
3666
3684
|
...(Object.keys(providerEnvironment).length === 0
|
|
3667
3685
|
? {}
|