Skip to content

feat(cli): allow opting out of log redaction - #1176

Merged
mldangelo-oai merged 3 commits into
mainfrom
mdangelo/codex/optional-log-redaction
Oct 1, 2026
Merged

mldangelo-oai merged 3 commits into
mainfrom
mdangelo/codex/optional-log-redaction

Conversation

@mldangelo-oai

@mldangelo-oai mldangelo-oai commented Oct 1, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Credential-shaped text can replace an entire CLI diagnostic with [redacted], hiding context needed for local troubleshooting. Add CODEX_SECURITY_REDACT_LOGS=0 to disable CLI diagnostic redaction independently of verbosity, and make scan warnings and errors follow the same redaction setting across plain stderr, verbose diagnostics, progress displays, and JSON errors.

Changes

  • Add one public environment variable: only the exact value 0 disables diagnostic redaction; unset and other values keep it enabled. Existing verbosity controls retain their behavior. No flags or log levels are added.
  • Apply existing credential checks to free-form diagnostic messages while retaining event names, classifications, counters, observer names, and dedicated path fields.
  • Let patch-risk stderr reports honor the opt-out while keeping persisted and published pull-request summaries redacted.
  • Keep settings local to each CLI invocation, including concurrent scans. Format worker diagnostics at the parent CLI output boundary; native worker logging remains unchanged.
  • Document the independent verbosity/redaction combinations, shell usage, sensitive-output risks, and limits in the README, CLI help, and generated schema descriptions.

Testing

  • Full randomized SDK suite (seed 2950192658): 3,306 passed, 51 skipped, 0 failed across 152 files.
  • Full SDK suite with seed 12345: 3,305 passed, 51 skipped, 1 test-environment failure. The isolated test working directory resolved a second React installation for a TUI subprocess. Linking the package dependencies into that test directory fixed the affected test; its rerun passed without source changes.
  • Eight built CLI checks passed for normal/verbose output with redaction unset, 0, 1, and false; stderr policy, JSON errors, exit codes, and verbosity stayed independent.
  • Packed and installed package checks passed, including public imports, NodeNext types, CLI startup, SDK lifecycle, MCP initialization, dashboard assets, and a nested worker without a global Codex installation.
  • Deep Scan worker tests passed; worker launch and native logging behavior remain unchanged.
  • SDK types, formatting, build, package-content checks, and CI build passed.
  • Plugin Ruff lint/format, source compatibility, and all 9 compatibility tests passed.
  • Three independent native code reviews and independent verification completed with no actionable findings.

Risk and rollout

Redaction remains enabled by default. This intentionally changes some scan warnings and errors that previously appeared raw on stderr: credential-shaped messages now show [redacted] unless CODEX_SECURITY_REDACT_LOGS=0 is set. Verbosity does not disable redaction, and disabling redaction does not enable more verbose output.

Raw model output, result data, session capture, and dedicated path fields remain unchanged. The setting does not change credential configuration, SDK sanitization, stored failure summaries, publication receipts, or native Codex/OpenTelemetry redaction, and cannot recover content already redacted upstream. Settings are not saved in scan recipes; choose them again when resuming or rerunning a scan. Output can contain sensitive information, especially with redaction disabled; keep it private and review it before sharing.

Public disclosure review

  • No customer, partner, prospect, or user identities, data, or identifying details are included.
  • No credentials, personal data, private source, scan findings, or nonpublic links or tickets are included.
  • I reviewed the branch name, title, description, commits, changes, comments, logs, screenshots, attachments, and links for public disclosure.

@github-actions github-actions Bot added the enhancement New feature or request label Oct 1, 2026
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 1, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-01T17:00:27.293473Z f56dbfd New commits
🔒 Security Review ✅ Completed 2026-10-01T17:00:40.384816Z f56dbfd New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: bc99a6b4f5

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread sdk/typescript/src/cli.ts
);
function safePatchText(
value: string,
environment: NodeJS.ProcessEnv = {},

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Honor the opt-out in patch-risk diagnostics

When a patch-risk assessment contains a credential-shaped line, runPatchRiskAssessment() displays it through safePatchReport(), whose calls to safePatchText() omit the environment; this {} default therefore keeps logErrorMessage() redacting the report even when CODEX_SECURITY_REDACT_LOGS=0. Thread dependencies.environment into the stderr-display path while retaining default redaction for the pull-request body.

AGENTS.md reference: AGENTS.md:L47-L50

Useful? React with 👍 / 👎.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5f7c399d90

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread sdk/typescript/src/cli.ts
Comment on lines +8714 to +8716
errorOutput.write(
`codex-security: warning: ${diagnosticMessage(warning)}\n`,
);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve the existing default warning output

When CODEX_SECURITY_REDACT_LOGS is unset, any scan warning containing credential-shaped text is now replaced wholesale with [redacted], whereas this callback previously printed the warning unchanged. This changes the default behavior while implementing an opt-out for existing redaction and forces users to disable redaction globally to recover warning context; restrict the new environment switch to boundaries that were already sanitized rather than introducing a new policy for scan status messages.

AGENTS.md reference: AGENTS.md:L38-L43

Useful? React with 👍 / 👎.

for (const kind of ["discovery", "dedup"]) {
for (const resumeThreadId of [undefined, "fixture-resumed-thread"]) {
launches.length = 0;
restoreEnv("CODEX_SECURITY_REDACT_LOGS", redactLogs);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Retain the redaction setting across worker launches

This reset before every executor.run() masks the cross-launch case the test claims to cover: production calls snapshotWorkerEnvironment() inside each run(), so if the parent environment changes after a discovery worker finishes, a subsequent reducer or resumed worker on the same executor inherits the new CODEX_SECURITY_REDACT_LOGS value rather than the scan's captured value. Capture the setting once per coordinator (or pass an immutable per-scan environment) and let this test leave the mutated parent value in place before later launches.

AGENTS.md reference: AGENTS.md:L30-L34

Useful? React with 👍 / 👎.

@soyeon-oai soyeon-oai left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM at f56dbfd. Reviewed diagnostic callers, exact opt-out/default/verbose behavior, concurrent invocation isolation, worker display routing, and persisted/published-summary protections. The opt-out stays confined to diagnostics while stored failure and PR-summary redaction remains intact. Verified the new regression cases in hosted CI (merge b335780 containing this head); no independent local test run. The earlier patch-risk environment omission is addressed in current source, and the proposed worker environment change was removed.

@mldangelo-oai
mldangelo-oai merged commit 4096958 into main Oct 1, 2026
56 checks passed
@mldangelo-oai
mldangelo-oai deleted the mdangelo/codex/optional-log-redaction branch October 1, 2026 18:21
@github-actions github-actions Bot mentioned this pull request Oct 1, 2026
3 tasks done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants