Skip to content

OpenAI's Codex Security CLI and TypeScript SDK for finding, validating, and fixing security vulnerabilities. npm: https://www.npmjs.com/package/@openai/codex-security

fix(bedrock): improve authentication and Blue/Red support (#1188)

mldangelo-oai5bd200978c8b
diff --git a/README.md b/README.md
index 8860215e8..b8c2453b4 100644
--- a/README.md
+++ b/README.md
@@ -96,13 +96,25 @@ classification operation; original scan severity stays unchanged. See [severity
## Other providers
-To use another inference provider, set its API key and select a model:
+Amazon Bedrock uses native Codex support; no connector or adapter is needed.
+Select an AWS profile, the region where your account can invoke the model, and
+the Bedrock model ID:
```bash
-export AWS_BEARER_TOKEN_BEDROCK="<your-bedrock-api-key>"
+export AWS_PROFILE="security-scan"
export AWS_REGION="us-east-2"
npx @openai/codex-security scan . --provider amazon-bedrock --model openai.gpt-5.6-luna
+```
+
+Run the exports and scan in the same shell. Bedrock also accepts bearer tokens
+and the AWS credential chain. Native Bedrock scans and local result viewing or
+export do not require an OpenAI CLI login. Daybreak Blue and Red still need
+[approved model access](docs/bedrock.md#daybreak-blue-and-red). Hosted publication has its
+own authentication requirements. See [Bedrock setup and verification](docs/bedrock.md).
+For other inference providers, set the provider's API key and select a model:
+
+```bash
export OPENROUTER_API_KEY="<your-openrouter-api-key>"
npx @openai/codex-security scan . --provider openrouter --model anthropic/claude-sonnet-4.5
diff --git a/docs/bedrock.md b/docs/bedrock.md
new file mode 100644
index 000000000..b5fff8c6a
--- /dev/null
+++ b/docs/bedrock.md
@@ -0,0 +1,236 @@
+# Amazon Bedrock setup and verification
+
+Codex Security uses Codex's native `amazon-bedrock` provider. Install
+`@openai/codex-security` normally; it includes the Codex executable and security
+plugin. No customer connector or API adapter is needed. Use the current release;
+version `0.1.27` and later includes the Bedrock reasoning-summary default and its
+propagation to Deep Scan workers.
+
+## Select AWS credentials and a model
+
+Run credential setup and the scan in the same shell or CI job. This example uses
+an existing AWS profile:
+
+```bash
+export AWS_PROFILE="security-scan"
+export AWS_REGION="us-east-2"
+npx @openai/codex-security scan /path/to/repository \
+ --provider amazon-bedrock --model openai.gpt-5.6-luna
+```
+
+Choose the region and exact Bedrock model ID your AWS identity can invoke. The
+example region and model do not grant access. Do not reuse an OpenAI API model
+name unless it is also the Bedrock model ID.
+
+Alternatively, use `AWS_BEARER_TOKEN_BEDROCK`, or export the credentials supplied
+by your AWS credential workflow:
+
+```bash
+export AWS_ACCESS_KEY_ID="<temporary-access-key-id>"
+export AWS_SECRET_ACCESS_KEY="<temporary-secret-access-key>"
+export AWS_SESSION_TOKEN="<temporary-session-token>"
+export AWS_REGION="us-east-2"
+```
+
+Temporary AWS credentials need the session token as well as the access key pair.
+Web identity, container credentials, and the default AWS credential chain are
+also supported. Avoid competing credential environment variables when selecting
+a profile. Exporting credentials in another terminal or child process does not
+configure an already-running shell. No AWS CLI installation is required by
+Codex Security itself.
+
+Once model access is provisioned, native Bedrock scanning uses AWS credentials
+without a separate `codex-security login` or OpenAI API key. Restricted models
+still require their approval and provisioning steps; see Daybreak Blue and Red below.
+Local Markdown/JSON reports, `scans show`, and `export` also
+need no cloud login. [Publishing to Cloud](../sdk/typescript/README.md#publish-findings-to-cloud)
+requires separate ChatGPT credentials and access to that destination.
+
+`info` and `scan --dry-run` check local state, not AWS authentication or model
+availability. A successful preflight is not a successful Bedrock invocation.
+Model-metadata and OpenAI access advisories are distinct from AWS authorization:
+check the actual inference response before concluding that access works or fails.
+For authentication or access-denied responses, check the chosen AWS identity,
+region, and permissions for that exact model.
+
+Model metadata comes from the bundled Codex executable. If it reports missing
+metadata, record that Codex version from `info --json`. An upstream metadata fix
+reaches installed users when a Codex Security release bundles the corrected
+Codex dependency; a successful inference alone does not verify all model metadata.
+
+Bedrock defaults `model_reasoning_summary` to `none` because some models reject
+`reasoning.summary`. This setting reaches Deep Scan discovery and reducer workers,
+including resumes. Reasoning effort is unchanged; an explicit summary override
+still takes precedence. See [provider configuration](../sdk/typescript/README.md#amazon-bedrock).
+
+## Daybreak Blue and Red
+
+Use the exact Bedrock identifier for the model your account can invoke:
+
+| Access | Bedrock model ID | AWS model card |
+| ------------- | ---------------------------------- | ------------------------------------------------------------------------------------------------------------------ |
+| Daybreak Blue | `openai.gpt-daybreak-blue-5.6-sol` | [Blue](https://docs.aws.amazon.com/en_en/bedrock/latest/userguide/model-card-openai-gpt-daybreak-blue-56-sol.html) |
+| Daybreak Red | `openai.gpt-5.6-cyber` | [Red](https://docs.aws.amazon.com/en_en/bedrock/latest/userguide/model-card-openai-gpt-56-cyber.html) |
+
+AWS lists `us-east-2` and the Bedrock Mantle Responses API for both models.
+The native provider handles that endpoint; no custom base URL or connector is
+needed. Access requires OpenAI Trusted Access for Cyber enrollment and approval,
+followed by AWS provisioning through your account team. Red requires separate
+Red approval and the model-specific approval for GPT-5.6-Cyber; Blue access does
+not grant Red access. See
+[OpenAI's Daybreak overview](https://help.openai.com/en/articles/20001258-openai-daybreak-trusted-access-for-cyber-overview).
+
+After that AWS access is granted, use your AWS credentials:
+
+```bash
+export AWS_PROFILE="security-scan"
+export AWS_REGION="us-east-2"
+npx @openai/codex-security scan /path/to/repository \
+ --provider amazon-bedrock --model openai.gpt-daybreak-blue-5.6-sol --effort high
+```
+
+For separately approved Red access, use:
+
+```bash
+npx @openai/codex-security scan /path/to/repository \
+ --provider amazon-bedrock --model openai.gpt-5.6-cyber --effort high
+```
+
+Neither command needs an additional OpenAI CLI sign-in after AWS model access
+is provisioned. The Bedrock reasoning-summary default remains `none` for both.
+
+Cost estimates and `--max-cost` recognize both exact Bedrock IDs using their
+AWS model cards' Standard commercial in-region rates, including the AWS fee.
+Blue reports a short/long-context range because aggregate usage does not identify
+each request's context tier. Red's card lists a 272K context window and only
+short-context pricing, so its upper estimate remains unavailable. Spending limits
+use the short-context baseline; they do not guarantee the final AWS bill. Pricing
+for other Bedrock model IDs is unchanged.
+
+## Repeatable live smoke test
+
+This optional maintainer check makes real, billable Bedrock requests against a
+small synthetic repository. Use an installed, pinned package version or a built
+package under test, with its bundled executable and plugin. Record `--version`
+and `info --json`; avoid a `CODEX_CLI_PATH` or `--plugin-path` override when testing
+the published package.
+
+The following POSIX-shell recipe uses an existing profile. Keep these variables
+in the same shell for all steps. Replace the executable path and profile with
+your test installation and authorized identity. The model below tests Daybreak
+Blue after access is granted. Set `model="openai.gpt-5.6-cyber"` for an approved
+Red test, or use `openai.gpt-5.6-luna` for a general Bedrock test if that is the
+model your account can invoke:
+
+```bash
+cli="/absolute/path/to/node_modules/.bin/codex-security"
+qa_root="$(mktemp -d)"
+mkdir "$qa_root/repository" "$qa_root/codex-home"
+export CODEX_HOME="$qa_root/codex-home"
+export CODEX_SECURITY_STATE_DIR="$qa_root/state"
+unset OPENAI_API_KEY CODEX_API_KEY OPENROUTER_API_KEY FIREWORKS_API_KEY
+unset CODEX_CLI_PATH CODEX_SECURITY_PROJECT_CONFIG
+unset AWS_ACCESS_KEY_ID AWS_SECRET_ACCESS_KEY AWS_SESSION_TOKEN AWS_BEARER_TOKEN_BEDROCK
+export AWS_PROFILE="security-scan"
+export AWS_REGION="us-east-2"
+model="openai.gpt-daybreak-blue-5.6-sol"
+"$cli" --version
+"$cli" info --json
+```
+
+Create a tiny public-search fixture with a known publication-filter bypass:
+
+```bash
+cat > "$qa_root/repository/app.py" <<'PY'
+import json
+import sqlite3
+from urllib.parse import parse_qs
+
+
+def application(environ, start_response):
+ term = parse_qs(environ.get("QUERY_STRING", "")).get("q", [""])[0]
+ with sqlite3.connect(":memory:") as database:
+ database.execute("CREATE TABLE notes (title TEXT, published INTEGER)")
+ database.executemany("INSERT INTO notes VALUES (?, ?)", [
+ ("Public introduction", 1), ("Unpublished synthetic draft", 0)
+ ])
+ query = f"SELECT title FROM notes WHERE published = 1 AND title LIKE '%{term}%'"
+ body = json.dumps(database.execute(query).fetchall()).encode()
+ start_response("200 OK", [("Content-Type", "application/json")])
+ return [body]
+PY
+cat > "$qa_root/repository/README.md" <<'MD'
+# Public note search
+
+The WSGI application accepts an unauthenticated query parameter `q` and returns
+matching published note titles. Unpublished titles must never be returned.
+All records are synthetic; the application uses only Python's standard library.
+MD
+git -C "$qa_root/repository" init
+git -C "$qa_root/repository" add app.py README.md
+git -C "$qa_root/repository" -c user.name="Test Fixture" \
+ -c user.email="[email protected]" -c commit.gpgsign=false \
+ commit -m "Add synthetic search fixture"
+```
+
+Run local preflight, then a Standard scan. Both commands use the same AWS setup:
+
+```bash
+"$cli" scan "$qa_root/repository" --provider amazon-bedrock --model "$model" \
+ --dry-run --json
+"$cli" scan "$qa_root/repository" --provider amazon-bedrock --model "$model" \
+ --effort high --output-dir "$qa_root/standard" --headless --verbose --json
+```
+
+Check the saved manifest, coverage, findings, and report. Expect the search term
+to be identified as altering the SQL publication filter. Record whether validation
+was static or executed; a successful scan is not itself proof of runtime testing.
+
+Run Deep Scan with one discovery worker and no nested subagents. Three discovery
+runs allow a finding and a follow-up convergence pass on this fixture:
+
+```bash
+"$cli" scan "$qa_root/repository" --provider amazon-bedrock --model "$model" \
+ --effort high --mode deep --workers 1 --subagents 0 \
+ --stop-after-no-new 1 --max-discovery-runs 3 \
+ --output-dir "$qa_root/deep" --headless --verbose --json
+```
+
+If a dedicated QA process exited unexpectedly and left a resumable Deep Scan,
+resume its saved scan ID in the same AWS environment. Normal Ctrl-C cancellation
+is a separate path and does not establish crash recovery:
+
+```bash
+"$cli" scans resume SCAN_ID --verbose --json
+```
+
+Resume reads the saved model, provider, reasoning settings, and original output
+directory. Confirm discovery and reducer workers, including resumed workers, use
+those settings and AWS authentication. Check the final stop reason and coverage;
+a limit-triggered partial scan or unrecovered worker failure is not a complete
+test. If no resumable scan is available, record this check as not run.
+
+Finally, view and export the saved result in a subshell without cloud credentials.
+The fresh credential files below exclude AWS profile credentials from this check:
+
+```bash
+(
+ unset OPENAI_API_KEY CODEX_API_KEY AWS_PROFILE AWS_DEFAULT_PROFILE
+ unset AWS_ACCESS_KEY_ID AWS_SECRET_ACCESS_KEY AWS_SESSION_TOKEN AWS_BEARER_TOKEN_BEDROCK
+ unset AWS_WEB_IDENTITY_TOKEN_FILE AWS_ROLE_ARN
+ unset AWS_CONTAINER_CREDENTIALS_RELATIVE_URI AWS_CONTAINER_CREDENTIALS_FULL_URI
+ export AWS_CONFIG_FILE="$qa_root/empty-aws-config"
+ export AWS_SHARED_CREDENTIALS_FILE="$qa_root/empty-aws-credentials"
+ export AWS_EC2_METADATA_DISABLED=true
+ : > "$AWS_CONFIG_FILE"
+ : > "$AWS_SHARED_CREDENTIALS_FILE"
+ "$cli" scans show SCAN_ID --json
+ "$cli" export "$qa_root/deep" --export-format sarif --output "$qa_root/deep.sarif"
+)
+```
+
+Confirm the local result and SARIF contain the same finding and locations. Keep
+credentials out of fixtures and recorded commands. Review logs and artifacts
+before sharing them. Record the tested package versions, AWS region, model,
+Standard/Deep/resume outcomes, warnings, and export result without credential or
+account identifiers.
diff --git a/plugins/codex-security/mcp-app/server.ts b/plugins/codex-security/mcp-app/server.ts
index 46dda5bd1..ed45d549a 100644
--- a/plugins/codex-security/mcp-app/server.ts
+++ b/plugins/codex-security/mcp-app/server.ts
@@ -631,7 +631,7 @@ export function createCodexSecurityServer(): McpServer {
{
title: "Check Codex Security Daybreak Access",
description:
- "Check this account's Daybreak access and available Daybreak programs. This check is advisory and never authorizes or blocks a scan.",
+ "Check this ChatGPT account's Daybreak access and available Daybreak programs. This check is advisory and never authorizes or blocks a scan. Skip it for Amazon Bedrock scans: it does not check AWS model access or access to local CLI results.",
inputSchema: z.object({}).strict(),
annotations: {
readOnlyHint: true,
@@ -689,7 +689,7 @@ export function createCodexSecurityServer(): McpServer {
};
const warning =
access.status === "not_granted"
- ? " This check is advisory: a scan may run, but protected results may not be displayable."
+ ? " This ChatGPT account check is advisory: a scan may run, but protected results associated with this account may not be displayable. It does not determine Amazon Bedrock model access or access to local CLI results."
: "";
return {
content: [
diff --git a/plugins/codex-security/mcp-app/tests/test_deep_scan_executor.mjs b/plugins/codex-security/mcp-app/tests/test_deep_scan_executor.mjs
index 535330007..f2be7dca9 100644
--- a/plugins/codex-security/mcp-app/tests/test_deep_scan_executor.mjs
+++ b/plugins/codex-security/mcp-app/tests/test_deep_scan_executor.mjs
@@ -1365,18 +1365,35 @@ async function testBedrockCredentialsReachWorker() {
const workingDirectory = path.join(fixture.root, "artifacts");
await mkdir(workingDirectory);
await writeFile(promptPath, "CAPTURE_SYNTHETIC_BEDROCK_AUTH\n");
- const result = await new CodexSdkWorkerExecutor({
+ const executor = new CodexSdkWorkerExecutor({
parentSandbox: trustedParentSandbox,
- }).run({
- kind: "discovery",
- promptPath,
- workingDirectory,
- subagents: 0,
- signal: new AbortController().signal,
});
- assert.equal(result.finalResponse, "fixture final response");
- const invocation = JSON.parse(await readFile(fixture.markerPath, "utf8"));
- assert.deepEqual(invocation.bedrockAuthentication, awsEnvironment);
+ for (const kind of ["discovery", "dedup"]) {
+ for (const resumeThreadId of [undefined, "fixture-bedrock-resume"]) {
+ const result = await executor.run({
+ kind,
+ promptPath,
+ workingDirectory,
+ subagents: 0,
+ resumeThreadId,
+ signal: new AbortController().signal,
+ });
+ assert.equal(result.finalResponse, "fixture final response");
+ const invocation = JSON.parse(
+ await readFile(fixture.markerPath, "utf8"),
+ );
+ assert.deepEqual(invocation.bedrockAuthentication, awsEnvironment);
+ assert.equal(
+ invocation.argv.includes("resume"),
+ resumeThreadId !== undefined,
+ );
+ assert.ok(
+ invocation.argv.some((arg) =>
+ arg.includes("mcp_servers.codex-security.enabled=false"),
+ ),
+ );
+ }
+ }
} finally {
for (const [name, value] of Object.entries(previousEnvironment)) {
restoreEnv(name, value);
diff --git a/plugins/codex-security/mcp-app/tests/test_mcp_app_smoke.mjs b/plugins/codex-security/mcp-app/tests/test_mcp_app_smoke.mjs
index 32ea0041b..647710dba 100644
--- a/plugins/codex-security/mcp-app/tests/test_mcp_app_smoke.mjs
+++ b/plugins/codex-security/mcp-app/tests/test_mcp_app_smoke.mjs
@@ -1206,6 +1206,11 @@ try {
assert.equal(trustedAccessTool.annotations.readOnlyHint, true);
assert.equal(trustedAccessTool.annotations.destructiveHint, false);
assert.equal(trustedAccessTool.annotations.openWorldHint, false);
+ assert.match(trustedAccessTool.description, /ChatGPT account/);
+ assert.match(
+ trustedAccessTool.description,
+ /Skip it for Amazon Bedrock scans/,
+ );
const unknownTrustedAccess = await requestAndWait(9601, "tools/call", {
name: "get_codex_security_daybreak_access",
@@ -1233,7 +1238,7 @@ try {
);
assert.doesNotMatch(
unknownTrustedAccess.result.content[0].text,
- /protected results may not be displayable/,
+ /protected results associated with this account may not be displayable/,
);
const grantedTrustedAccess = {
@@ -1384,7 +1389,11 @@ try {
);
assert.match(
refreshedTrustedAccess.result.content[0].text,
- /protected results may not be displayable/,
+ /protected results associated with this account may not be displayable/,
+ );
+ assert.match(
+ refreshedTrustedAccess.result.content[0].text,
+ /does not determine Amazon Bedrock model access/,
);
const timestampedTrustedAccess = await requestAndWait(9608, "tools/call", {
diff --git a/plugins/codex-security/references/config-preflight.md b/plugins/codex-security/references/config-preflight.md
index a8ace9596..ca8a369b2 100644
--- a/plugins/codex-security/references/config-preflight.md
+++ b/plugins/codex-security/references/config-preflight.md
@@ -90,7 +90,7 @@ Codex CLI and other hosts use the same prompt-based preflight before substantive
## Daybreak Access Advisory
-After capability preflight is `ready` and immediately before the workflow's first substantive scan action, call the plugin's `get_codex_security_daybreak_access` tool once only if it is available in the current session. If the tool is unavailable, skip the advisory silently: do not attempt a call, probe for it, or use a replacement access tool or connector. ChatGPT-authenticated desktop and CLI sessions support this advisory; skip it silently in known API-key-only sessions, which cannot verify account access. For Deep Security Scan, make the call immediately before `start_codex_security_deep_scan`. Reuse an existing result when continuing the same scan.
+After capability preflight is `ready` and immediately before the workflow's first substantive scan action, call the plugin's `get_codex_security_daybreak_access` tool once only if it is available in the current session. If the tool is unavailable, skip the advisory silently: do not attempt a call, probe for it, or use a replacement access tool or connector. This advisory checks the connected ChatGPT account or workspace; it does not check Amazon Bedrock model access or access to local CLI scan results. ChatGPT-authenticated desktop and CLI sessions support it. Skip it silently for Amazon Bedrock scans and known API-key-only sessions; neither requires an OpenAI account advisory. Use the selected runtime provider to identify Bedrock, not merely the presence of AWS environment variables. For Deep Security Scan, make the call immediately before `start_codex_security_deep_scan`. Reuse an existing result when continuing the same scan.
If the call fails, returns `status: "unknown"`, or returns `stale: true`, continue silently. Do not expose the unavailable check, unknown status, empty program list, or a speculative protected-output warning in progress messages or the final response. For a fresh `granted` result, report the exact status and available Daybreak programs. For a fresh `not_granted` result, before any other scan-start progress, present a separate, prominent warning that Daybreak access is not granted for this account and protected scan outputs may not be displayable. Include the returned `enrollmentUrl` as a clickable application link, falling back to `https://chatgpt.com/cyber` when absent.
diff --git a/plugins/codex-security/skills/deep-security-scan/SKILL.md b/plugins/codex-security/skills/deep-security-scan/SKILL.md
index df9d22db1..ef4cd1932 100644
--- a/plugins/codex-security/skills/deep-security-scan/SKILL.md
+++ b/plugins/codex-security/skills/deep-security-scan/SKILL.md
@@ -39,7 +39,7 @@ After preserving any native continuation's scan context and applying its one-tim
## Daybreak Access Advisory
-Immediately before the first `start_codex_security_deep_scan` call, the top-level parent calls the plugin's `get_codex_security_daybreak_access` tool once only if it is available in the current session; workers never perform this advisory. If the tool is unavailable, skip the advisory silently: do not attempt a call, probe for it, or use a replacement access tool or connector. ChatGPT-authenticated desktop and CLI sessions support this advisory; skip it silently in known API-key-only sessions, which cannot verify account access. Reuse an existing result when continuing the same scan.
+Immediately before the first `start_codex_security_deep_scan` call, the top-level parent calls the plugin's `get_codex_security_daybreak_access` tool once only if it is available in the current session; workers never perform this advisory. If the tool is unavailable, skip the advisory silently: do not attempt a call, probe for it, or use a replacement access tool or connector. This advisory checks the connected ChatGPT account or workspace; it does not check Amazon Bedrock model access or access to local CLI scan results. ChatGPT-authenticated desktop and CLI sessions support it. Skip it silently for Amazon Bedrock scans and known API-key-only sessions; neither requires an OpenAI account advisory. Use the selected runtime provider to identify Bedrock, not merely the presence of AWS environment variables. Reuse an existing result when continuing the same scan.
If the call fails, returns `status: "unknown"`, or returns `stale: true`, continue silently. Do not expose the unavailable check, unknown status, empty program list, or a speculative protected-output warning in progress messages or the final response. For a fresh `granted` result, report the exact status and available Daybreak programs. For a fresh `not_granted` result, prominently warn before scan-start progress that Daybreak access is not granted and protected outputs may not be displayable, and include the returned `enrollmentUrl` as a clickable application link, falling back to `https://chatgpt.com/cyber` when absent.
diff --git a/sdk/typescript/README.md b/sdk/typescript/README.md
index 14cb10068..5d8cbae26 100644
--- a/sdk/typescript/README.md
+++ b/sdk/typescript/README.md
@@ -252,16 +252,68 @@ npx @openai/codex-security scan . --provider openrouter --model anthropic/claude
export FIREWORKS_API_KEY="<your-fireworks-api-key>"
npx @openai/codex-security scan . --provider fireworks --model accounts/fireworks/models/qwen3-235b-a22b
+```
+
+### Amazon Bedrock
+
+Bedrock uses Codex's native provider; no custom connector or adapter is needed.
+Choose an AWS identity and a region with access to the exact Bedrock model ID:
-export AWS_BEARER_TOKEN_BEDROCK="<your-bedrock-api-key>"
+```bash
+export AWS_PROFILE="security-scan"
export AWS_REGION="us-east-2"
npx @openai/codex-security scan . --provider amazon-bedrock --model openai.gpt-5.6-luna
```
-Bedrock also accepts AWS access keys, profiles, web identity, container
-credentials, and the default AWS credential chain. Set `AWS_REGION` and choose
-a Bedrock model with `--model`; OpenAI models such as `openai.gpt-5.6-luna`
-support `--max-cost`.
+For an AWS account with approved Daybreak Blue access in `us-east-2`:
+
+```bash
+npx @openai/codex-security scan . --provider amazon-bedrock \
+ --model openai.gpt-daybreak-blue-5.6-sol --effort high
+```
+
+For separately approved Daybreak Red model access in the same region:
+
+```bash
+npx @openai/codex-security scan . --provider amazon-bedrock \
+ --model openai.gpt-5.6-cyber --effort high
+```
+
+Both require OpenAI approval/enrollment followed by AWS model-access provisioning.
+Red requires separate Red approval and the model-specific approval for
+GPT-5.6-Cyber; Blue access does not include it. Contact your AWS account team.
+See the AWS model cards for
+[Blue](https://docs.aws.amazon.com/en_en/bedrock/latest/userguide/model-card-openai-gpt-daybreak-blue-56-sol.html)
+and [Red](https://docs.aws.amazon.com/en_en/bedrock/latest/userguide/model-card-openai-gpt-56-cyber.html),
+and [OpenAI's access overview](https://help.openai.com/en/articles/20001258-openai-daybreak-trusted-access-for-cyber-overview).
+
+Run the exports and CLI command in the same shell, job, or container. Environment
+changes in another terminal or a completed subprocess do not reach the scan.
+Instead of a profile, you can use `AWS_BEARER_TOKEN_BEDROCK`, AWS access keys, web
+identity, container credentials, or the default AWS credential chain. Temporary
+access keys require all three of `AWS_ACCESS_KEY_ID`, `AWS_SECRET_ACCESS_KEY`,
+and `AWS_SESSION_TOKEN`. Set `AWS_REGION` for the selected model's region and
+avoid mixing a profile with unrelated credential environment variables.
+
+Once model access is provisioned, native Bedrock scans, including Deep Scan
+workers, use AWS authentication without a separate `codex-security login` or
+OpenAI API key. AWS still controls whether that identity can invoke the model.
+Reading local reports, `scans show`, and `export` requires no cloud login.
+[Publishing to Cloud](#publish-findings-to-cloud) is a separate operation that
+requires ChatGPT credentials; AWS inference credentials do not grant that access.
+
+`info` and `scan --dry-run` inspect local configuration and inputs. They do not
+verify AWS credentials or invoke the model. A model-metadata or OpenAI access
+advisory does not establish Bedrock access; use the actual inference result.
+An AWS authentication error or model-access denial must be resolved for the
+selected AWS identity, model, and region. See the
+[Bedrock verification guide](../../docs/bedrock.md) for a live scan recipe.
+
+OpenAI models such as `openai.gpt-5.6-luna` support `--max-cost`. The exact
+`openai.gpt-daybreak-blue-5.6-sol` ID has AWS Standard commercial in-region price
+estimates, including short/long-context ranges and the included AWS fee. These
+estimates enable `--max-cost`; they are not billing totals or a guaranteed bill
+limit. This pricing entry does not change other Bedrock models' estimates.
Bedrock scans, including Deep Scan workers, default to
`model_reasoning_summary = "none"` because some Bedrock models reject
@@ -270,7 +322,10 @@ settings in `--codex` overrides or the selected Codex profile take precedence.
For standard scans on older CLI versions, append
`--codex 'model_reasoning_summary="none"'` to your scan command if Bedrock
reports that `reasoning.summary` is unsupported. Deep scans require a CLI
-version that forwards this setting to workers.
+version that forwards this setting to discovery and reducer workers, including
+resumed workers. Version `0.1.27` and later includes that fix.
+
+### OpenAI credentials
On Windows, set the API key in PowerShell:
diff --git a/sdk/typescript/src/api.ts b/sdk/typescript/src/api.ts
index 8160fbde1..fe602fdf9 100644
--- a/sdk/typescript/src/api.ts
+++ b/sdk/typescript/src/api.ts
@@ -1794,6 +1794,7 @@ export class CodexSecurity {
: options.scanPrompt,
options.maxCostUsd !== undefined,
discoveryPrompt,
+ modelProvider,
);
checkOpen();
const feedback = await workbench(
@@ -1953,6 +1954,7 @@ export class CodexSecurity {
pluginRoot: runtime.plugin.installedRoot,
expectation,
authentication,
+ modelProvider,
workbenchValidated: true,
model,
onThreadStarted: async (threadId) => {
@@ -3648,6 +3650,7 @@ interface ScanEventRunOptions {
pluginRoot: string;
expectation: ScanExpectation;
authentication?: ScanAuthentication;
+ modelProvider?: unknown;
workbenchValidated?: boolean;
model?: string;
expectedFilesTotal?: number;
@@ -3678,7 +3681,11 @@ export async function runScanEvents(
thread: options.thread,
events: options.events,
onEvent: async (event) => {
- if (!tacStatusReported) {
+ if (
+ !tacStatusReported &&
+ options.modelProvider !== "amazon-bedrock" &&
+ options.authentication?.method !== "aws_credentials"
+ ) {
const tacStatus = trustedAccessStatusFromEvent(event);
if (tacStatus !== null) {
tacStatusReported = true;
@@ -3978,6 +3985,7 @@ function scanPrompt(
additionalPrompt?: string,
enforceCostLimit = false,
discoveryPrompt?: string,
+ modelProvider?: unknown,
): string {
const python = pluginPythonCommand();
const customValidation = discoveryPrompt !== undefined;
@@ -3985,6 +3993,11 @@ function scanPrompt(
discoveryPrompt ??
`Use the installed $codex-security:${skillName} skill at ${shellEnvironmentReference("CODEX_SECURITY_PLUGIN_ROOT", `/skills/${skillName}/SKILL.md`)}.`,
"Run this Codex Security scan non-interactively.",
+ ...(modelProvider === "amazon-bedrock"
+ ? [
+ "This scan uses Amazon Bedrock with AWS authentication. Skip the ChatGPT account Daybreak access advisory, including get_codex_security_daybreak_access and get_tac_status; it does not check Bedrock model access or access to local scan results. OpenAI login is not required for this scan. Report any actual provider error unchanged.",
+ ]
+ : []),
...(mode === "deep"
? [
`The SDK has already registered this scan. Call start_codex_security_deep_scan with ${JSON.stringify({ scanId })}; never pass targetPath or create another scan.`,
@@ -4479,6 +4492,19 @@ export function classifyConnectionFailure(
if (/\b(?:sqlite3?|database|workbench)\b/iu.test(message)) {
return "unknown";
}
+ if (
+ /\b(?:ExpiredTokenException|UnrecognizedClientException|IncompleteSignature)\b/iu.test(
+ message,
+ )
+ ) {
+ return "unauthorized";
+ }
+ if (
+ /\b(?:AccessDeniedException|NotAuthorized|OptInRequired)\b/iu.test(message)
+ ) {
+ return "forbidden";
+ }
+ if (/\bThrottlingException\b/iu.test(message)) return "rate_limited";
if (
/\brate[_ -]?limit(?:ed|[_ -]exceeded)?\b|\b429\b|\btoo many requests\b/iu.test(
message,
diff --git a/sdk/typescript/src/cli.ts b/sdk/typescript/src/cli.ts
index a24418efd..d7af73c9f 100644
--- a/sdk/typescript/src/cli.ts
+++ b/sdk/typescript/src/cli.ts
@@ -8553,6 +8553,9 @@ async function executeScan(
},
onAuthentication: (authentication) => {
selectedAuthentication = authentication;
+ const bedrock =
+ providerOptions.provider === "amazon-bedrock" ||
+ authentication.method === "aws_credentials";
diagnostic("authentication.selected", {
requested: auth ?? DEFAULT_SCAN_AUTH,
method: authentication.method,
@@ -8570,6 +8573,11 @@ async function executeScan(
? "Using native Codex command authentication"
: "Using stored Codex credentials",
);
+ if (bedrock) {
+ dashboard.note(
+ "Amazon Bedrock uses AWS authentication; OpenAI sign-in is not required for model access or local results.",
+ );
+ }
return;
}
progress?.stopTimer();
@@ -8589,6 +8597,11 @@ async function executeScan(
} else {
progress?.stage("Authentication: stored Codex credentials.");
}
+ if (bedrock) {
+ progress?.stage(
+ "Amazon Bedrock uses AWS authentication; OpenAI sign-in is not required for model access or local results.",
+ );
+ }
progress?.startTimer("Preparing scan");
},
onTrustedAccessStatus: (status) => {
@@ -8775,7 +8788,11 @@ async function executeScan(
const message =
failure instanceof OutputInsideProtectedRootError
? errorMessage(protectedRootErrorMessage(failure))
- : scanFailureMessage(failure, selectedAuthentication);
+ : scanFailureMessage(
+ failure,
+ selectedAuthentication,
+ providerOptions.provider,
+ );
diagnostic("scan.failed", {
classification:
costLimitFailure !== undefined
@@ -9110,16 +9127,49 @@ function authenticationFailureMessage(
function scanFailureMessage(
error: unknown,
authentication: ScanAuthentication | null,
+ provider?: string,
): string {
// A local failure keeps its own message. Classification matches bare words
// such as "permission denied" anywhere in the text, so an EACCES from a
// read-only TMPDIR would otherwise be reported as a credential problem.
- //
- // The advice branches below still replace the underlying text rather than
- // appending it. That is deliberate: upstream authentication and authorization
- // errors can name the organization or project, which must not reach stderr or
- // the JSON error field.
if (isLocalScanFailure(error)) return diagnosticValue(error);
+ const classification = classifyConnectionFailure(error);
+ if (
+ provider === "amazon-bedrock" ||
+ authentication?.method === "aws_credentials"
+ ) {
+ const detail = diagnosticValue(error);
+ switch (classification) {
+ case "unauthorized":
+ if (authentication?.method === "command") {
+ return `${detail}\n${authenticationFailureMessage(authentication)}`;
+ }
+ if (authentication?.method === "aws_credentials") {
+ return (
+ `${detail}\n${authenticationFailureMessage(authentication)} ` +
+ (authentication.source === "AWS_BEARER_TOKEN_BEDROCK"
+ ? "Refresh AWS_BEARER_TOKEN_BEDROCK in the environment running this command."
+ : "Refresh the selected AWS credentials in the environment running this command. Temporary access-key credentials also require AWS_SESSION_TOKEN.")
+ );
+ }
+ return `${detail}\nAmazon Bedrock authentication failed. Check the credentials configured for the selected provider.`;
+ case "forbidden":
+ if (authentication?.method === "command") {
+ return (
+ `${detail}\nThe configured provider auth command's credentials cannot access the Amazon Bedrock model. ` +
+ "Check the configured provider auth command, AWS identity and Bedrock model permissions, configured AWS region, and model ID."
+ );
+ }
+ return (
+ `${detail}\nThe AWS credentials${authentication?.method === "aws_credentials" ? ` from ${authentication.source}` : ""} cannot access the configured Amazon Bedrock model. ` +
+ "Check your AWS identity and Bedrock model permissions, configured AWS region, and model ID."
+ );
+ case "rate_limited":
+ return `${detail}\nAmazon Bedrock throttled the request. Check the model quota in the configured AWS region and retry.`;
+ default:
+ return detail;
+ }
+ }
const message = errorMessage(error);
const nativeRefreshRecovery = message.match(
/\b(?:your access token could not be refreshed because you have since logged out or signed in to another account\. Please sign in again\.|your authentication session could not be refreshed automatically\. Please log out and sign in again\.)/iu,
@@ -9137,19 +9187,13 @@ function scanFailureMessage(
"Otherwise run 'npx @openai/codex-security logout', then 'npx @openai/codex-security login'."
);
}
- switch (classifyConnectionFailure(error)) {
+ switch (classification) {
case "unauthorized":
return authenticationFailureMessage(authentication);
case "forbidden":
if (authentication?.method === "command") {
return "The configured Codex provider denied access. Check the command credentials and provider permissions.";
}
- if (authentication?.method === "aws_credentials") {
- return (
- `The AWS credentials from ${authentication.source} cannot access the configured Amazon Bedrock model. ` +
- "Check your AWS identity and Bedrock model permissions."
- );
- }
return authentication?.method === "api_key"
? `The API key from ${authentication.source} cannot access the configured model. ` +
"Retry with '--auth chatgpt' or use an API key with model access."
diff --git a/sdk/typescript/src/cost-model.ts b/sdk/typescript/src/cost-model.ts
index b54ca4601..b3adcbf49 100644
--- a/sdk/typescript/src/cost-model.ts
+++ b/sdk/typescript/src/cost-model.ts
@@ -49,6 +49,38 @@ export interface ScanTokenUsage {
total_tokens: number;
}
+const BEDROCK_MODEL_PRICING: Readonly<
+ Record<
+ string,
+ {
+ short: ModelPricing;
+ long?: ModelPricing;
+ unitsPerUsd: number;
+ source: string;
+ asOf: string;
+ }
+ >
+> = {
+ // AWS commercial in-region Standard prices already include the 10% fee.
+ "openai.gpt-daybreak-blue-5.6-sol": {
+ short: [4_400, 440, 5_500, 22_000],
+ long: [8_800, 880, 11_000, 33_000],
+ unitsPerUsd: 1_000_000_000,
+ source:
+ "https://docs.aws.amazon.com/en_en/bedrock/latest/userguide/model-card-openai-gpt-daybreak-blue-56-sol.html",
+ asOf: "2026-10-01",
+ },
+ "openai.gpt-5.6-cyber": {
+ // Half-nanodollar units preserve the $17.1875/M cache-write rate exactly,
+ // including an odd number of cache-write tokens.
+ short: [27_500, 2_750, 34_375, 165_000],
+ unitsPerUsd: 2_000_000_000,
+ source:
+ "https://docs.aws.amazon.com/en_en/bedrock/latest/userguide/model-card-openai-gpt-56-cyber.html",
+ asOf: "2026-10-01",
+ },
+};
+
const MODEL_PRICING_NANODOLLARS: Readonly<Record<string, ModelPricing>> = {
// GPT-5.5 has no additional cache-write charge.
"gpt-5.5": [5_000, 500, 5_000, 30_000],
@@ -84,13 +116,17 @@ const LONG_CONTEXT_PRICING_NANODOLLARS: Readonly<Record<string, ModelPricing>> =
"gpt-daybreak-blue-latest": [8_000, 800, 10_000, 30_000],
};
-function usdPerMillionTokens(pricing: ModelPricing): TokenPrices {
+function usdPerMillionTokens(
+ pricing: ModelPricing,
+ unitsPerUsd: number,
+): TokenPrices {
const [input, cacheRead, cacheWrite, output] = pricing;
+ const unitsPerMillion = unitsPerUsd / 1_000_000;
return {
- input: input / 1_000,
- cacheRead: cacheRead / 1_000,
- cacheWrite: cacheWrite / 1_000,
- output: output / 1_000,
+ input: input / unitsPerMillion,
+ cacheRead: cacheRead / unitsPerMillion,
+ cacheWrite: cacheWrite / unitsPerMillion,
+ output: output / unitsPerMillion,
};
}
@@ -141,10 +177,13 @@ export function estimateScanCost(
usage: unknown,
): ScanCost | null {
if (model === undefined) return null;
+ const bedrockPricing = BEDROCK_MODEL_PRICING[model];
+ const unitsPerUsd = bedrockPricing?.unitsPerUsd ?? 1_000_000_000;
const pricingModel = model.startsWith("openai.")
? model.slice("openai.".length)
: model;
- const pricing = MODEL_PRICING_NANODOLLARS[pricingModel];
+ const pricing =
+ bedrockPricing?.short ?? MODEL_PRICING_NANODOLLARS[pricingModel];
const normalized = tokenUsage(usage);
if (pricing === undefined || normalized === null) return null;
const [inputRate, cachedInputRate, cacheWriteInputRate, outputRate] = pricing;
@@ -155,15 +194,17 @@ export function estimateScanCost(
output_tokens: outputTokens,
} = normalized;
- const nanodollars =
+ const costUnits =
(inputTokens - cachedInputTokens - cacheWriteInputTokens) * inputRate +
cachedInputTokens * cachedInputRate +
cacheWriteInputTokens * cacheWriteInputRate +
outputTokens * outputRate;
- if (!Number.isSafeInteger(nanodollars)) return null;
+ if (!Number.isSafeInteger(costUnits)) return null;
- const longPricing = LONG_CONTEXT_PRICING_NANODOLLARS[pricingModel];
- let maximumNanodollars: number | null = null;
+ const longPricing = bedrockPricing
+ ? bedrockPricing.long
+ : LONG_CONTEXT_PRICING_NANODOLLARS[pricingModel];
+ let maximumUnits: number | null = null;
if (longPricing !== undefined) {
const [longInput, longRead, longWrite, longOutput] = longPricing;
// Unclassified input may include additional cache writes. Preserve the
@@ -177,7 +218,7 @@ export function estimateScanCost(
cachedInputTokens * longRead +
cacheWriteInputTokens * longWrite +
outputTokens * longOutput;
- if (Number.isSafeInteger(maximum)) maximumNanodollars = maximum;
+ if (Number.isSafeInteger(maximum)) maximumUnits = maximum;
}
return {
@@ -189,27 +230,34 @@ export function estimateScanCost(
? { cacheWriteInputTokensReported: false }
: {}),
outputTokens,
- estimatedUsd: nanodollars / 1_000_000_000,
+ estimatedUsd: costUnits / unitsPerUsd,
estimatedUsdRange: {
- min: nanodollars / 1_000_000_000,
- max:
- maximumNanodollars === null ? null : maximumNanodollars / 1_000_000_000,
+ min: costUnits / unitsPerUsd,
+ max: maximumUnits === null ? null : maximumUnits / unitsPerUsd,
context: "unknown",
},
pricing: {
- source: pricingModel.startsWith("gpt-5.5")
- ? "https://developers.openai.com/api/docs/models/gpt-5.5"
- : "https://developers.openai.com/api/docs/pricing",
- asOf:
- pricingModel === "gpt-6.1-sol" || pricingModel === "gpt-6-luna"
+ source: bedrockPricing
+ ? bedrockPricing.source
+ : pricingModel.startsWith("gpt-5.5")
+ ? "https://developers.openai.com/api/docs/models/gpt-5.5"
+ : "https://developers.openai.com/api/docs/pricing",
+ asOf: bedrockPricing
+ ? bedrockPricing.asOf
+ : pricingModel === "gpt-6.1-sol" || pricingModel === "gpt-6-luna"
? "2026-09-30"
: "2026-09-14",
serviceTier: "standard",
context: "short",
- usdPerMillionTokens: usdPerMillionTokens(pricing),
+ usdPerMillionTokens: usdPerMillionTokens(pricing, unitsPerUsd),
...(longPricing === undefined
? {}
- : { longContextUsdPerMillionTokens: usdPerMillionTokens(longPricing) }),
+ : {
+ longContextUsdPerMillionTokens: usdPerMillionTokens(
+ longPricing,
+ unitsPerUsd,
+ ),
+ }),
},
};
}
diff --git a/sdk/typescript/tests-ts/api-events.test.ts b/sdk/typescript/tests-ts/api-events.test.ts
index 28d9b1212..e94379b71 100644
--- a/sdk/typescript/tests-ts/api-events.test.ts
+++ b/sdk/typescript/tests-ts/api-events.test.ts
@@ -274,6 +274,59 @@ describe("one-shot scan events", () => {
}
});
+ test("does not apply ChatGPT account advisories to Bedrock scans", async () => {
+ for (const authentication of [
+ { method: "aws_credentials", source: "AWS_PROFILE", verified: false },
+ { method: "command", verified: false },
+ ] as const) {
+ for (const status of ["granted", "not_granted", "unknown"] as const) {
+ const scanDir = await copyCompletedScan(await temporaryDirectory());
+ const warnings: string[] = [];
+ const statuses: ScanTrustedAccessStatus[] = [];
+ const result = await runEvents(
+ scanDir,
+ tacEvents([tacToolCall(status)]),
+ {
+ authentication,
+ modelProvider: "amazon-bedrock",
+ onWarning: (warning) => warnings.push(warning),
+ onTrustedAccessStatus: (value) => statuses.push(value),
+ },
+ );
+
+ expect(result.turnResult.status).toBe("completed");
+ expect(warnings).toEqual([]);
+ expect(statuses).toEqual([]);
+ }
+ }
+ });
+
+ test("preserves Bedrock failures after an inapplicable account advisory", async () => {
+ const scanDir = join(await temporaryDirectory(), "partial-scan");
+ await mkdir(scanDir, { mode: 0o700 });
+ const message =
+ "HTTP 403 ExpiredTokenException: The security token included in the request is expired";
+ const warnings: string[] = [];
+ async function* events(): AsyncGenerator<ThreadEvent> {
+ yield { type: "thread.started", thread_id: "thread-1" };
+ yield { type: "item.completed", item: tacToolCall("not_granted") };
+ yield { type: "turn.failed", error: { message } };
+ }
+
+ await expect(
+ runEvents(scanDir, events(), {
+ authentication: {
+ method: "aws_credentials",
+ source: "AWS_PROFILE",
+ verified: false,
+ },
+ modelProvider: "amazon-bedrock",
+ onWarning: (warning) => warnings.push(warning),
+ }),
+ ).rejects.toMatchObject({ name: CodexSecurityError.name, message });
+ expect(warnings).toEqual([]);
+ });
+
test("does not mistake external-provider keys for OpenAI API organizations", async () => {
for (const source of ["OPENROUTER_API_KEY", "FIREWORKS_API_KEY"] as const) {
for (const status of ["not_granted", "unknown"] as const) {
diff --git a/sdk/typescript/tests-ts/api-preflight-config.test.ts b/sdk/typescript/tests-ts/api-preflight-config.test.ts
index 982f5b38e..d679103e5 100644
--- a/sdk/typescript/tests-ts/api-preflight-config.test.ts
+++ b/sdk/typescript/tests-ts/api-preflight-config.test.ts
@@ -22,6 +22,7 @@ import {
type JsonObject,
} from "../src/config.js";
import { PLUGIN_ROOT } from "./plugin-root.js";
+import { TestClient } from "./support/api-client.js";
const temporaryDirectories: string[] = [];
const EXTERNAL_PROVIDER_CASES = [
@@ -87,6 +88,51 @@ function runPreflight(
}
describe("CodexSecurity preflight configuration", () => {
+ test.each([
+ ["standard", "openai.gpt-daybreak-blue-5.6-sol"],
+ ["deep", "openai.gpt-daybreak-blue-5.6-sol"],
+ ["standard", "openai.gpt-5.6-cyber"],
+ ["deep", "openai.gpt-5.6-cyber"],
+ ] as const)(
+ "accepts a cost limit for a %s Bedrock %s scan without starting inference",
+ async (mode, model) => {
+ const root = await temporaryDirectory();
+ const repository = join(root, "repository");
+ await mkdir(repository);
+ await using client = new TestClient(
+ {
+ codexOverrides: {
+ model_provider: "amazon-bedrock",
+ model,
+ },
+ },
+ {
+ environment: {
+ AWS_PROFILE: "synthetic-bedrock-profile",
+ AWS_REGION: "us-east-2",
+ CODEX_SECURITY_STATE_DIR: join(root, "state"),
+ },
+ prepareRuntime: async () => {
+ throw new Error("Local preflight must not start the runtime");
+ },
+ },
+ );
+ await expect(
+ client.preflight(repository, { mode, maxCostUsd: 1 }),
+ ).resolves.toMatchObject({
+ mode,
+ modelProvider: "amazon-bedrock",
+ model,
+ maxCostUsd: 1,
+ authentication: {
+ method: "aws_credentials",
+ source: "AWS_PROFILE",
+ verified: false,
+ },
+ });
+ },
+ );
+
test.skipIf(process.platform !== "win32")(
"loads trusted project config through a Windows path alias",
async () => {
diff --git a/sdk/typescript/tests-ts/api.test.ts b/sdk/typescript/tests-ts/api.test.ts
index bab090810..3ff35ba7e 100644
--- a/sdk/typescript/tests-ts/api.test.ts
+++ b/sdk/typescript/tests-ts/api.test.ts
@@ -750,6 +750,24 @@ describe("CodexSecurity orchestration", () => {
);
});
+ test.each([
+ ["HTTP 403 ExpiredTokenException", "unauthorized"],
+ ["HTTP 403 UnrecognizedClientException", "unauthorized"],
+ ["HTTP 400 IncompleteSignature", "unauthorized"],
+ ["AccessDeniedException", "forbidden"],
+ ["NotAuthorized", "forbidden"],
+ ["HTTP 401 NotAuthorized", "forbidden"],
+ ["OptInRequired", "forbidden"],
+ ["ThrottlingException", "rate_limited"],
+ ] as const)(
+ "classifies Bedrock error %s as %s",
+ (message, classification) => {
+ expect(classifyConnectionFailure(new Error(message))).toBe(
+ classification,
+ );
+ },
+ );
+
test.each([
["root configuration", { approval_policy: "never" }],
[
@@ -1755,6 +1773,50 @@ describe("CodexSecurity orchestration", () => {
await client.close();
});
+ test.each(["standard", "deep"] as const)(
+ "identifies Bedrock account advisory applicability in the %s parent prompt",
+ async (mode) => {
+ const root = await temporaryDirectory();
+ const repository = join(root, "repository");
+ const codexHome = join(root, "codex-home");
+ const scanDir = join(root, "scan");
+ await mkdir(repository);
+ await mkdir(codexHome);
+ await mkdir(scanDir, { mode: 0o700 });
+ const client = new TestClient(
+ { codexOverrides: { model_provider: "amazon-bedrock" } },
+ {
+ environment: { AWS_PROFILE: "synthetic-bedrock" },
+ prepareRuntime: async () => preparedRuntime(codexHome),
+ resolvePluginPython: async () => "/managed/python",
+ prepareOutputDir: async () => scanDir,
+ repositoryRevision: async () => "deadbeef",
+ createCodex: () => ({
+ startThread: () => ({
+ id: null,
+ async runStreamed(prompt) {
+ expect(prompt).toContain(
+ "Amazon Bedrock with AWS authentication",
+ );
+ expect(prompt).toContain(
+ "Skip the ChatGPT account Daybreak access advisory",
+ );
+ expect(prompt).toContain(
+ "Report any actual provider error unchanged",
+ );
+ throw new Error("Bedrock prompt captured");
+ },
+ }),
+ }),
+ },
+ );
+ await expect(client.run(repository, { mode })).rejects.toThrow(
+ "Bedrock prompt captured",
+ );
+ await client.close();
+ },
+ );
+
test("isolates resolved Deep settings across concurrent Bedrock scans", async () => {
const root = await temporaryDirectory();
const repository = join(root, "repository");
diff --git a/sdk/typescript/tests-ts/cli-authentication.test.ts b/sdk/typescript/tests-ts/cli-authentication.test.ts
index cc807fefd..574118785 100644
--- a/sdk/typescript/tests-ts/cli-authentication.test.ts
+++ b/sdk/typescript/tests-ts/cli-authentication.test.ts
@@ -415,24 +415,51 @@ describe("CLI authentication", () => {
expect(stderr.text()).toContain(
`method="aws_credentials" source="${source}"`,
);
+ expect(stderr.text()).toContain(
+ "OpenAI sign-in is not required for model access or local results",
+ );
expect(stderr.text()).not.toContain("synthetic-");
expect(stderr.text()).not.toContain("stored Codex credentials");
expect(stderr.text()).not.toContain("--auth chatgpt");
}
});
- test("provides provider-aware Amazon Bedrock authentication failure guidance", async () => {
- for (const [detail, expected] of [
- [
- "401 invalid credentials for org-private",
- "Check your Amazon Bedrock bearer token",
- ],
- [
- "403 model access denied for org-private",
- "Check your AWS identity and Bedrock model permissions",
- ],
- ] as const) {
+ test.each([
+ [
+ "401 invalid credentials for org-private",
+ "Check your Amazon Bedrock bearer token",
+ "unauthorized",
+ ],
+ [
+ "403 model access denied for org-private",
+ "Check your AWS identity and Bedrock model permissions",
+ "forbidden",
+ ],
+ [
+ "403 ExpiredTokenException: The security token included in the request has expired.",
+ "Refresh AWS_BEARER_TOKEN_BEDROCK",
+ "unauthorized",
+ ],
+ [
+ "UnrecognizedClientException: The security token included in the request is invalid.",
+ "Refresh AWS_BEARER_TOKEN_BEDROCK",
+ "unauthorized",
+ ],
+ [
+ "AccessDeniedException: Not authorized to invoke the selected model.",
+ "configured AWS region, and model ID",
+ "forbidden",
+ ],
+ [
+ "400 ThrottlingException: Too many tokens, please wait before trying again.",
+ "Check the model quota in the configured AWS region",
+ "rate_limited",
+ ],
+ ] as const)(
+ "preserves Bedrock failure details and recovery advice: %s",
+ async (detail, expected, classification) => {
const stderr = capture(false);
+ const stdout = capture();
const deps = dependencies({
environment: { AWS_BEARER_TOKEN_BEDROCK: "synthetic-bedrock-bearer" },
});
@@ -451,20 +478,142 @@ describe("CLI authentication", () => {
expect(
await main(
- ["scan", "--codex", 'model_provider="amazon-bedrock"'],
- capture().stream,
+ [
+ "scan",
+ "--codex",
+ 'model_provider="amazon-bedrock"',
+ "--json",
+ "--verbose",
+ "--full-output",
+ ],
+ stdout.stream,
stderr.stream,
deps,
),
).toBe(2);
expect(stderr.text()).toContain(expected);
+ expect(stderr.text()).toContain(detail);
+ expect(stderr.text()).toContain(`classification="${classification}"`);
+ expect(JSON.parse(stdout.text()).error.message).toContain(detail);
+ expect(JSON.parse(stdout.text()).error.message).toContain(expected);
expect(stderr.text()).toContain("AWS_BEARER_TOKEN_BEDROCK");
expect(stderr.text()).not.toContain("synthetic-");
- expect(stderr.text()).not.toContain("org-private");
expect(stderr.text()).not.toContain("--auth chatgpt");
- }
+ },
+ );
+
+ test("explains refreshing temporary AWS profile credentials without a stored OpenAI login", async () => {
+ const stderr = capture(false);
+ const deps = dependencies({
+ environment: { AWS_PROFILE: "synthetic-profile" },
+ });
+ deps.createSecurity = () => ({
+ run: async (_repository, options) => {
+ options?.onAuthentication?.({
+ method: "aws_credentials",
+ source: "AWS_PROFILE",
+ verified: false,
+ });
+ throw new CodexSecurityError(
+ "403 ExpiredTokenException: security token has expired",
+ );
+ },
+ preflight: async () => fakePreflight(),
+ close: async () => {},
+ });
+ expect(
+ await main(
+ ["scan", "--codex", 'model_provider="amazon-bedrock"'],
+ capture().stream,
+ stderr.stream,
+ deps,
+ ),
+ ).toBe(2);
+ expect(stderr.text()).toContain("ExpiredTokenException");
+ expect(stderr.text()).toContain("AWS_PROFILE");
+ expect(stderr.text()).toContain("AWS_SESSION_TOKEN");
+ expect(stderr.text()).not.toContain(
+ "cannot access the configured Amazon Bedrock model",
+ );
+ expect(stderr.text()).not.toContain("codex-security login");
});
+ test.each([
+ [
+ "UnrecognizedClientException: The security token included in the request is invalid.",
+ "Check the configured provider auth command",
+ "unauthorized",
+ ],
+ [
+ "403 ExpiredTokenException: The security token included in the request has expired.",
+ "Check the configured provider auth command",
+ "unauthorized",
+ ],
+ [
+ "401 NotAuthorized: You do not have permission to perform this action.",
+ "AWS identity and Bedrock model permissions, configured AWS region, and model ID",
+ "forbidden",
+ ],
+ [
+ "AccessDeniedException: Not authorized to invoke the selected model.",
+ "Check the configured provider auth command",
+ "forbidden",
+ ],
+ [
+ "400 ThrottlingException: Too many tokens, please wait before trying again.",
+ "Check the model quota in the configured AWS region",
+ "rate_limited",
+ ],
+ ] as const)(
+ "preserves command-authenticated Bedrock diagnostics in stderr and JSON: %s",
+ async (detail, expected, classification) => {
+ const stderr = capture(false);
+ const stdout = capture();
+ const deps = dependencies();
+ deps.createSecurity = () => ({
+ run: async (_repository, options) => {
+ options?.onAuthentication?.({ method: "command", verified: false });
+ throw new CodexSecurityError(detail);
+ },
+ preflight: async () => fakePreflight(),
+ close: async () => {},
+ });
+ expect(
+ await main(
+ [
+ "scan",
+ "--codex",
+ 'model_provider="amazon-bedrock"',
+ "--codex",
+ 'model_providers.amazon-bedrock.auth={command="synthetic-auth"}',
+ "--json",
+ "--verbose",
+ "--full-output",
+ ],
+ stdout.stream,
+ stderr.stream,
+ deps,
+ ),
+ ).toBe(2);
+
+ const message = JSON.parse(stdout.text()).error.message;
+ for (const output of [stderr.text(), message]) {
+ expect(output).toContain(detail);
+ expect(output).toContain(expected);
+ expect(output).not.toContain("--auth chatgpt");
+ expect(output).not.toContain("codex-security login");
+ expect(output).not.toContain("stored ChatGPT credentials");
+ expect(output).not.toContain("AWS_BEARER_TOKEN_BEDROCK");
+ expect(output).not.toContain("AWS_SESSION_TOKEN");
+ }
+ expect(stderr.text()).toContain(`classification="${classification}"`);
+ expect(stderr.text()).toContain("Authentication: native Codex command");
+ expect(stderr.text()).toContain(
+ "OpenAI sign-in is not required for model access or local results",
+ );
+ },
+ );
+
test("offers the existing interactive prompt when both sign-ins are available", async () => {
for (const [argv, selection] of [
[["scan"], "chatgpt"],
diff --git a/sdk/typescript/tests-ts/cost-context.test.ts b/sdk/typescript/tests-ts/cost-context.test.ts
index b198747cd..d146df0b0 100644
--- a/sdk/typescript/tests-ts/cost-context.test.ts
+++ b/sdk/typescript/tests-ts/cost-context.test.ts
@@ -39,6 +39,83 @@ test.each([
},
);
+test("prices the exact Bedrock Daybreak Blue ID with AWS short and long context rates", () => {
+ const usage = {
+ input_tokens: 1_000_000,
+ cached_input_tokens: 200_000,
+ cache_write_input_tokens: 300_000,
+ output_tokens: 100_000,
+ };
+ const cost = estimateScanCost("openai.gpt-daybreak-blue-5.6-sol", usage)!;
+ expect(cost).toMatchObject({
+ model: "openai.gpt-daybreak-blue-5.6-sol",
+ estimatedUsd: 6.138,
+ estimatedUsdRange: { min: 6.138, max: 11.176, context: "unknown" },
+ pricing: {
+ source:
+ "https://docs.aws.amazon.com/en_en/bedrock/latest/userguide/model-card-openai-gpt-daybreak-blue-56-sol.html",
+ asOf: "2026-10-01",
+ serviceTier: "standard",
+ context: "short",
+ usdPerMillionTokens: {
+ input: 4.4,
+ cacheRead: 0.44,
+ cacheWrite: 5.5,
+ output: 22,
+ },
+ longContextUsdPerMillionTokens: {
+ input: 8.8,
+ cacheRead: 0.88,
+ cacheWrite: 11,
+ output: 33,
+ },
+ },
+ });
+ expect(estimateScanCost("gpt-daybreak-blue-5.6-sol", usage)).toBeNull();
+});
+
+test("prices the exact Bedrock Daybreak Red ID without inventing long-context rates", () => {
+ const usage = {
+ input_tokens: 1_000_000,
+ cached_input_tokens: 200_000,
+ cache_write_input_tokens: 300_000,
+ output_tokens: 100_000,
+ };
+ const cost = estimateScanCost("openai.gpt-5.6-cyber", usage)!;
+ expect(cost).toMatchObject({
+ model: "openai.gpt-5.6-cyber",
+ estimatedUsd: 20.55625,
+ estimatedUsdRange: { min: 20.55625, max: null, context: "unknown" },
+ pricing: {
+ source:
+ "https://docs.aws.amazon.com/en_en/bedrock/latest/userguide/model-card-openai-gpt-56-cyber.html",
+ asOf: "2026-10-01",
+ serviceTier: "standard",
+ context: "short",
+ usdPerMillionTokens: {
+ input: 13.75,
+ cacheRead: 1.375,
+ cacheWrite: 17.1875,
+ output: 82.5,
+ },
+ },
+ });
+ expect(cost.pricing).not.toHaveProperty("longContextUsdPerMillionTokens");
+ expect(estimateScanCost("gpt-5.6-cyber", usage)).toBeNull();
+});
+
+test.each([1, 3])(
+ "retains a Bedrock Red estimate for %i cache-write tokens",
+ (written) => {
+ const cost = estimateScanCost("openai.gpt-5.6-cyber", {
+ input_tokens: written,
+ cache_write_input_tokens: written,
+ output_tokens: 0,
+ });
+ expect(cost?.estimatedUsd).toBe((written * 17.1875) / 1_000_000);
+ },
+);
+
test("reports a range for cache-heavy scans without changing the budget baseline", () => {
const cost = estimateScanCost("gpt-5.6-sol", {
input_tokens: 150_000_000,
diff --git a/sdk/typescript/tests-ts/cost-model.property.test.ts b/sdk/typescript/tests-ts/cost-model.property.test.ts
index b9557aec2..2067dc039 100644
--- a/sdk/typescript/tests-ts/cost-model.property.test.ts
+++ b/sdk/typescript/tests-ts/cost-model.property.test.ts
@@ -15,6 +15,7 @@ const rates = [
["gpt-5.6-luna", 200n, 20n, 250n, 1200n],
["gpt-daybreak-blue-latest", 4000n, 400n, 5000n, 20000n],
["gpt-daybreak-red-latest", 12500n, 1250n, 15625n, 75000n],
+ ["openai.gpt-daybreak-blue-5.6-sol", 4400n, 440n, 5500n, 22000n],
] as const;
const count = fc.integer({ min: 0, max: 1_000_000_000 });
const usageParts = fc.record({
@@ -70,7 +71,10 @@ describe("cost-model invariants", () => {
BigInt(parts.cached) * cachedRate +
BigInt(parts.written) * writeRate +
BigInt(parts.output) * outputRate;
- for (const selected of [model, `openai.${model}`]) {
+ const identifiers = model.startsWith("openai.")
+ ? [model]
+ : [model, `openai.${model}`];
+ for (const selected of identifiers) {
expect(estimateScanCost(selected, tokens)).toMatchObject({
model: selected,
inputTokens: tokens.input_tokens,
@@ -86,6 +90,25 @@ describe("cost-model invariants", () => {
);
});
+ test("matches an exact integer oracle for fractional-nanodollar Bedrock Red rates", () => {
+ fc.assert(
+ fc.property(usageParts, (parts) => {
+ const halfNanodollars =
+ BigInt(parts.uncached) * 27_500n +
+ BigInt(parts.cached) * 2_750n +
+ BigInt(parts.written) * 34_375n +
+ BigInt(parts.output) * 165_000n;
+ expect(
+ estimateScanCost("openai.gpt-5.6-cyber", usage(parts)),
+ ).toMatchObject({
+ estimatedUsd: Number(halfNanodollars) / 2_000_000_000,
+ estimatedUsdRange: { max: null },
+ });
+ }),
+ propertyOptions,
+ );
+ });
+
test("normalizes legacy cache writes without double charging", () => {
fc.assert(
fc.property(usageParts, (parts) => {
diff --git a/sdk/typescript/tests-ts/scan-resume.test.ts b/sdk/typescript/tests-ts/scan-resume.test.ts
index e1e2b2a0d..0c7abc786 100644
--- a/sdk/typescript/tests-ts/scan-resume.test.ts
+++ b/sdk/typescript/tests-ts/scan-resume.test.ts
@@ -34,6 +34,7 @@ async function interruptedScan(
"safetyIdentifier" | "postScanPrompt" | "auth"
> = {},
resolvedDeep = false,
+ modelProvider?: string,
) {
const root = await temporaryDirectory();
const repository = bulk
@@ -100,6 +101,9 @@ async function interruptedScan(
TMP: process.env["TMP"],
CODEX_HOME: codexHome,
CODEX_SECURITY_STATE_DIR: join(root, "state"),
+ ...(modelProvider === "amazon-bedrock"
+ ? { AWS_PROFILE: "synthetic-bedrock" }
+ : {}),
...(settings.safetyIdentifier === undefined
? {}
: { OPENAI_API_KEY: "synthetic-resume-key" }),
@@ -110,7 +114,11 @@ async function interruptedScan(
repository,
target: { kind: "repository", paths: [] },
mode,
- config: { model: "gpt-5.6-sol", approval_policy: "never" },
+ config: {
+ model: "gpt-5.6-sol",
+ approval_policy: "never",
+ ...(modelProvider === undefined ? {} : { model_provider: modelProvider }),
+ },
pluginVersion: "0.1.0",
requiresScanPrompt: true,
...settings,
@@ -397,6 +405,47 @@ test("CLI resumes the owning Codex thread and preserves running state on a trans
expect(await readFile(f.checkpoint, "utf8")).toBe('{"completed":"setup"}\n');
});
+test("resumed Bedrock scans retain provider context for the account advisory", async () => {
+ const f = await interruptedScan("deep", false, {}, false, "amazon-bedrock");
+ const stdout = capture();
+ const stderr = capture();
+ const code = await main(
+ ["scans", "resume", f.scanId, "--json"],
+ stdout.stream,
+ stderr.stream,
+ {
+ ...dependencies({ environment: f.environment, currentDirectory: f.root }),
+ runWorkbench: f.command,
+ createSecurity: resumeClient(f, (options) => ({
+ startThread() {
+ throw new Error("Resume must not create a new thread.");
+ },
+ resumeThread(threadId) {
+ expect(threadId).toBe(f.threadId);
+ expect(options.env).toMatchObject({
+ AWS_PROFILE: "synthetic-bedrock",
+ });
+ expect(options.apiKey).toBeUndefined();
+ return {
+ id: threadId,
+ async runStreamed(prompt) {
+ expect(prompt).toContain(
+ "Amazon Bedrock with AWS authentication",
+ );
+ expect(prompt).toContain(
+ "Skip the ChatGPT account Daybreak access advisory",
+ );
+ throw new Error("Resumed Bedrock prompt captured");
+ },
+ };
+ },
+ })),
+ },
+ );
+ expect(code).not.toBe(0);
+ expect(stderr.text()).toContain("Resumed Bedrock prompt captured");
+});
+
function resumeClient(
f: Awaited<ReturnType<typeof interruptedScan>>,
createCodex: NonNullable<
diff --git a/sdk/typescript/tests-ts/support/api-events.ts b/sdk/typescript/tests-ts/support/api-events.ts
index 2306bea65..1b8ab48b2 100644
--- a/sdk/typescript/tests-ts/support/api-events.ts
+++ b/sdk/typescript/tests-ts/support/api-events.ts
@@ -37,6 +37,7 @@ export type ScanObserverName = Parameters<
type ScanEventOptions = Pick<
Parameters<typeof runScanEvents>[0],
| "authentication"
+ | "modelProvider"
| "expectedFilesTotal"
| "onActivity"
| "onObserverError"