@openai/codex-security 0.1.6 → 0.1.7
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 +10 -0
- package/_bundled_plugin/.mcp.json +16 -0
- package/dist/api.d.ts +4 -0
- package/dist/api.d.ts.map +1 -1
- package/dist/api.js +55 -18
- package/dist/api.js.map +1 -1
- package/dist/cli.d.ts +1 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +31 -12
- package/dist/cli.js.map +1 -1
- package/dist/config.d.ts +1 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +18 -10
- package/dist/config.js.map +1 -1
- package/dist/cost.d.ts.map +1 -1
- package/dist/cost.js +4 -1
- package/dist/cost.js.map +1 -1
- package/package.json +2 -2
package/dist/cli.d.ts
CHANGED
|
@@ -59,7 +59,7 @@ export declare function readSkillCommandOutput(stream: AsyncIterable<Buffer | st
|
|
|
59
59
|
malformed: boolean;
|
|
60
60
|
}>;
|
|
61
61
|
export declare function skillCommandFailure(command: "validate" | "patch", status: number, detail: string): string;
|
|
62
|
-
export declare function parseCodexOverrides(values: readonly string[], model?: string, effort?: ModelReasoningEffort, provider?: "openai" | ExternalModelProvider): JsonObject;
|
|
62
|
+
export declare function parseCodexOverrides(values: readonly string[], model?: string, effort?: ModelReasoningEffort, provider?: "openai" | "amazon-bedrock" | ExternalModelProvider): JsonObject;
|
|
63
63
|
export declare class Progress {
|
|
64
64
|
#private;
|
|
65
65
|
constructor(stream?: Writable, dependencies?: Pick<CliDependencies, "now" | "setInterval" | "clearInterval">, interactive?: boolean);
|
package/dist/cli.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AA2BA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAG9D,OAAO,EAEL,aAAa,EAOd,MAAM,UAAU,CAAC;AAElB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,EACzB,KAAK,CAAC,EAAE,MAAM,EACd,MAAM,CAAC,EAAE,oBAAoB,EAC7B,QAAQ,CAAC,EAAE,QAAQ,GAAG,gBAAgB,GAAG,qBAAqB,GAC7D,UAAU,CAwFZ;AAwBD,qBAAa,QAAQ;;gBAcjB,MAAM,GAAE,QAAyB,EACjC,YAAY,GAAE,IAAI,CAChB,eAAe,EACf,KAAK,GAAG,aAAa,GAAG,eAAe,CACjB,EACxB,WAAW,UAAO;IAQpB,IAAW,WAAW,IAAI,OAAO,CAEhC;IAED,IAAW,cAAc,IAAI,MAAM,CAKlC;IAEM,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAI5B,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAejC,SAAS,IAAI,IAAI;IAgBjB,eAAe,CAAC,KAAK,EAAE,MAAM,IAAI,GAAG,IAAI;CA2BhD"}
|
package/dist/cli.js
CHANGED
|
@@ -12,7 +12,7 @@ import { parse as parseToml } from "smol-toml";
|
|
|
12
12
|
import { classifyConnectionFailure, CodexSecurity, scanAuthentication, } from "./api.js";
|
|
13
13
|
import { accountStatus } from "./auth.js";
|
|
14
14
|
import { createBulkScanDiscoveryDependencies, runBulkScanWizard, } from "./bulk-scan-discovery.js";
|
|
15
|
-
import { DEFAULT_CODEX_CONFIG, EXTERNAL_CODEX_PROVIDERS, isExternalModelProvider, mergedCodexConfig, scanModelConfiguration, } from "./config.js";
|
|
15
|
+
import { DEFAULT_CODEX_CONFIG, EXTERNAL_CODEX_PROVIDERS, isExternalModelProvider, mergedCodexConfig, scanModelConfiguration, scanModelProvider, } from "./config.js";
|
|
16
16
|
import { formatUsd } from "./cost.js";
|
|
17
17
|
import { CodexSecurityError, ConfigurationError, InvalidTargetError, OutputDirectoryError, OutputInsideProtectedRootError, PluginPythonUnavailableError, redactedErrorMessage, ScanCostLimitExceededError, ScanInterruptedError, } from "./errors.js";
|
|
18
18
|
import { runMultiscan } from "./multiscan.js";
|
|
@@ -96,7 +96,7 @@ const VALUE_OPTIONS = new Set([
|
|
|
96
96
|
"--reason",
|
|
97
97
|
]);
|
|
98
98
|
const PROVIDER_OPTION = z
|
|
99
|
-
.enum(["openai", "openrouter", "fireworks"])
|
|
99
|
+
.enum(["openai", "openrouter", "fireworks", "amazon-bedrock"])
|
|
100
100
|
.default("openai")
|
|
101
101
|
.describe("Inference provider for scans.");
|
|
102
102
|
function optionValue(flag) {
|
|
@@ -2047,13 +2047,14 @@ async function runScan(arguments_, errorOutput, dependencies, interactive = true
|
|
|
2047
2047
|
parseCodexOverrides(arguments_.codex, arguments_.model, arguments_.effort, arguments_.provider),
|
|
2048
2048
|
};
|
|
2049
2049
|
const selectedProfileName = config.codexOverrides?.["profile"];
|
|
2050
|
+
const effectiveConfiguration = {
|
|
2051
|
+
...DEFAULT_CODEX_CONFIG,
|
|
2052
|
+
...config.codexOverrides,
|
|
2053
|
+
};
|
|
2050
2054
|
({ model: effectiveModel, reasoningEffort: effectiveReasoningEffort } =
|
|
2051
|
-
scanModelConfiguration(
|
|
2052
|
-
...DEFAULT_CODEX_CONFIG,
|
|
2053
|
-
...config.codexOverrides,
|
|
2054
|
-
}));
|
|
2055
|
+
scanModelConfiguration(effectiveConfiguration));
|
|
2055
2056
|
let auth = arguments_.auth;
|
|
2056
|
-
const provider =
|
|
2057
|
+
const provider = scanModelProvider(effectiveConfiguration);
|
|
2057
2058
|
selectedAuthentication = scanAuthentication(dependencies.environment, auth, provider);
|
|
2058
2059
|
if (!isExternalModelProvider(provider) &&
|
|
2059
2060
|
(auth === undefined || auth === "auto") &&
|
|
@@ -2217,7 +2218,7 @@ async function runScan(arguments_, errorOutput, dependencies, interactive = true
|
|
|
2217
2218
|
diagnostic("authentication.selected", {
|
|
2218
2219
|
requested: auth ?? "auto",
|
|
2219
2220
|
method: authentication.method,
|
|
2220
|
-
source: authentication.method
|
|
2221
|
+
source: authentication.method !== "stored_credentials"
|
|
2221
2222
|
? authentication.source
|
|
2222
2223
|
: undefined,
|
|
2223
2224
|
verified: authentication.verified,
|
|
@@ -2225,7 +2226,9 @@ async function runScan(arguments_, errorOutput, dependencies, interactive = true
|
|
|
2225
2226
|
if (dashboard !== null) {
|
|
2226
2227
|
dashboard.note(authentication.method === "api_key"
|
|
2227
2228
|
? `Using API key from ${authentication.source}`
|
|
2228
|
-
:
|
|
2229
|
+
: authentication.method === "aws_credentials"
|
|
2230
|
+
? `Using AWS credentials from ${authentication.source}`
|
|
2231
|
+
: "Using stored Codex credentials");
|
|
2229
2232
|
return;
|
|
2230
2233
|
}
|
|
2231
2234
|
progress?.stopTimer();
|
|
@@ -2233,6 +2236,9 @@ async function runScan(arguments_, errorOutput, dependencies, interactive = true
|
|
|
2233
2236
|
progress?.stage(`Authentication: API key from ${authentication.source}.`);
|
|
2234
2237
|
progress?.stage("To use your ChatGPT sign-in, retry with --auth chatgpt.");
|
|
2235
2238
|
}
|
|
2239
|
+
else if (authentication.method === "aws_credentials") {
|
|
2240
|
+
progress?.stage(`Authentication: AWS credentials from ${authentication.source}.`);
|
|
2241
|
+
}
|
|
2236
2242
|
else {
|
|
2237
2243
|
progress?.stage("Authentication: stored Codex credentials.");
|
|
2238
2244
|
}
|
|
@@ -2446,7 +2452,7 @@ async function runScan(arguments_, errorOutput, dependencies, interactive = true
|
|
|
2446
2452
|
model: effectivePreflight.model,
|
|
2447
2453
|
reasoning_effort: effectivePreflight.reasoningEffort,
|
|
2448
2454
|
method: effectivePreflight.authentication.method,
|
|
2449
|
-
source: effectivePreflight.authentication.method
|
|
2455
|
+
source: effectivePreflight.authentication.method !== "stored_credentials"
|
|
2450
2456
|
? effectivePreflight.authentication.source
|
|
2451
2457
|
: undefined,
|
|
2452
2458
|
verified: effectivePreflight.authentication.verified,
|
|
@@ -2542,6 +2548,10 @@ function scanFailureMessage(error, authentication) {
|
|
|
2542
2548
|
return sanitizeDiagnosticValue(error);
|
|
2543
2549
|
switch (classifyConnectionFailure(error)) {
|
|
2544
2550
|
case "unauthorized":
|
|
2551
|
+
if (authentication?.method === "aws_credentials") {
|
|
2552
|
+
return (`Authentication failed using AWS credentials from ${authentication.source}. ` +
|
|
2553
|
+
"Check your Amazon Bedrock bearer token or AWS credential chain.");
|
|
2554
|
+
}
|
|
2545
2555
|
return authentication?.method === "api_key"
|
|
2546
2556
|
? `Authentication failed using ${authentication.source}. ` +
|
|
2547
2557
|
"Your ChatGPT sign-in was not used. " +
|
|
@@ -2549,6 +2559,10 @@ function scanFailureMessage(error, authentication) {
|
|
|
2549
2559
|
: "Authentication failed using stored ChatGPT credentials. " +
|
|
2550
2560
|
"Sign in again with 'codex-security login' or provide a valid API key.";
|
|
2551
2561
|
case "forbidden":
|
|
2562
|
+
if (authentication?.method === "aws_credentials") {
|
|
2563
|
+
return (`The AWS credentials from ${authentication.source} cannot access the configured Amazon Bedrock model. ` +
|
|
2564
|
+
"Check your AWS identity and Bedrock model permissions.");
|
|
2565
|
+
}
|
|
2552
2566
|
return authentication?.method === "api_key"
|
|
2553
2567
|
? `The API key from ${authentication.source} cannot access the configured model. ` +
|
|
2554
2568
|
"Retry with '--auth chatgpt' or use an API key with model access."
|
|
@@ -2742,6 +2756,9 @@ export function parseCodexOverrides(values, model, effort, provider) {
|
|
|
2742
2756
|
[provider]: { ...EXTERNAL_CODEX_PROVIDERS[provider] },
|
|
2743
2757
|
};
|
|
2744
2758
|
}
|
|
2759
|
+
else if (provider === "amazon-bedrock") {
|
|
2760
|
+
result["model_provider"] = provider;
|
|
2761
|
+
}
|
|
2745
2762
|
for (const value of values) {
|
|
2746
2763
|
const separator = value.indexOf("=");
|
|
2747
2764
|
const key = separator < 0 ? "" : value.slice(0, separator);
|
|
@@ -2791,14 +2808,16 @@ export function parseCodexOverrides(values, model, effort, provider) {
|
|
|
2791
2808
|
if (effort !== undefined && key === "model_reasoning_effort") {
|
|
2792
2809
|
throw new CodexSecurityError("--effort conflicts with --codex model_reasoning_effort");
|
|
2793
2810
|
}
|
|
2794
|
-
if (isExternalModelProvider(provider)
|
|
2811
|
+
if ((isExternalModelProvider(provider) || provider === "amazon-bedrock") &&
|
|
2812
|
+
key === "model_provider") {
|
|
2795
2813
|
throw new CodexSecurityError("--provider conflicts with --codex model_provider");
|
|
2796
2814
|
}
|
|
2797
2815
|
throw new CodexSecurityError("Duplicate --codex key");
|
|
2798
2816
|
}
|
|
2799
2817
|
cursor[final] = parsed;
|
|
2800
2818
|
}
|
|
2801
|
-
if (isExternalModelProvider(provider)
|
|
2819
|
+
if ((isExternalModelProvider(provider) || provider === "amazon-bedrock") &&
|
|
2820
|
+
!("model" in result)) {
|
|
2802
2821
|
throw new CodexSecurityError(`--model is required when using --provider ${provider}`);
|
|
2803
2822
|
}
|
|
2804
2823
|
return result;
|