Skip to content

feat: add verbose security scan diagnostics - #63

Merged
mldangelo-oai merged 23 commits into
mainfrom
mdangelo/codex/security-scan-verbose
Aug 3, 2026
Merged

feat: add verbose security scan diagnostics#63
mldangelo-oai merged 23 commits into
mainfrom
mdangelo/codex/security-scan-verbose

Conversation

@mldangelo-oai

@mldangelo-oai mldangelo-oai commented Jul 29, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Add opt-in codex-security scan --verbose diagnostics entirely in the CLI; leave the bundled plugin and public SDK API unchanged.
  • Support CODEX_SECURITY_LOG_LEVEL=debug and Promptfoo-compatible LOG_LEVEL=debug; document flag precedence and identify both environment variables as CLI-only.
  • Emit redacted lifecycle, authentication, worker progress, reconnect, warning, cost, completion, and cleanup diagnostics to stderr without contaminating structured JSON stdout.
  • Resolve the selected Codex profile consistently across CLI and SDK preflight, scan diagnostics, live cost tracking, budget enforcement, final scan results, persisted scan costs, and saved reruns.
  • Correctly inherit root model or reasoning settings when the selected profile overrides only one field; reject invalid selected-profile values.
  • Keep raw provider, observer, and cleanup failure details out of structured diagnostics while preserving classified failures and existing user-facing recovery messages.
  • Normalize ASCII controls and Unicode line separators in diagnostic values and scanner warnings to prevent forged log records.
  • Preserve interactive terminal progress and cursor state; report ordinary, cached, cache-write, and output token counts without exposing API keys or authentication tokens.
  • Merge the latest main, preserving managed Codex credential keyrings, transient environment API keys, hardened Windows sandbox compatibility, expanded Node 22/24/26 CI, portable npm package-smoke timeouts, native multi-agent worker limits, and 0.1.3 release metadata.
  • Preserve the single-scan quick start, managed credential-security guidance, and Markdown-safe package documentation; clarify that logging controls are CLI-only.

Test plan

  • bun test --timeout 30000 ./tests-ts493 passed, 6 existing integration/platform skips, 0 failures; 499 tests across 30 files.
  • Focused selected-profile configuration, real SDK cost accounting and persisted pricing, CLI, authentication, token-cost, and portable package-timeout suites — 228 passed, 0 failures.
  • pnpm --dir sdk/typescript run types.
  • pnpm --dir sdk/typescript run format.
  • pnpm --dir sdk/typescript run build.
  • Fresh npm tarball installation with an isolated writable npm cache and node sdk/typescript/scripts/check-package.mjs <packed-tarball> — public SDK import, installed CLI, 95 bundled plugin files and all 179 package entries.
  • Real built-CLI dry-run matrix — 12 passing modes covering quiet defaults, --verbose, both log-level variables and precedence, explicit and legacy overrides, all three selected-profile combinations, consistent diagnostics and JSON stdout, and no paid scan.
  • Dedicated regressions verify selected-profile model pricing, scan-budget enforcement, profile-aware preflight, persisted scan costs, provider/observer/cleanup redaction, Unicode log-record safety, managed-keyring isolation, cache-write accounting, portable Windows package timeouts, and one-scan quick-start safety.

Maintainer tracking

Related to #70: verbose diagnostics may improve scan observability, but this PR does not by itself establish scan-progress guarantees.

…ty-scan-verbose

# Conflicts:
#	README.md
#	sdk/typescript/README.md
#	sdk/typescript/src/cli.ts
#	sdk/typescript/tests-ts/cli.test.ts
@mldangelo-oai

Copy link
Copy Markdown
Collaborator Author

@codex review

ianw-oai
ianw-oai previously approved these changes Jul 29, 2026

@ianw-oai ianw-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.

Looks good. I left one non-blocking suggestion to keep the quick start from running multiple paid scans.

Comment thread README.md Outdated

Copilot AI 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.

Pull request overview

Adds an opt-in verbose diagnostics mode for the codex-security scan CLI that emits redacted lifecycle telemetry to stderr (and supports env-based enablement) while preserving clean JSON stdout for CI and tooling.

Changes:

  • Introduces --verbose (and CODEX_SECURITY_LOG_LEVEL=debug / LOG_LEVEL=debug) to enable redacted scan lifecycle diagnostics on stderr.
  • Implements structured diagnostic events across scan configuration, authentication, worker status, reconnects, warnings, cost updates, completion, and cleanup.
  • Expands test coverage and updates READMEs + package smoke test to validate help text and verbosity behaviors.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
sdk/typescript/src/cli.ts Adds verbose flag parsing and emits redacted diagnostic events to stderr throughout runScan.
sdk/typescript/tests-ts/cli.test.ts Adds extensive tests ensuring verbose diagnostics don’t contaminate JSON stdout, and validates env precedence + redaction.
sdk/typescript/scripts/smoke-package.mjs Extends installed-CLI smoke checks to assert scan --help documents --verbose and CODEX_SECURITY_LOG_LEVEL=debug.
sdk/typescript/README.md Documents --verbose and env-var enablement, including precedence rules and what diagnostics include.
README.md Adds quick-start examples for --verbose and env-driven diagnostics.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@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: 45fd824abd

ℹ️ 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 Outdated
Comment thread sdk/typescript/src/cli.ts
Comment thread sdk/typescript/src/cli.ts
@mldangelo-oai

Copy link
Copy Markdown
Collaborator Author

@codex review

ianw-oai
ianw-oai previously approved these changes Jul 29, 2026

@ianw-oai ianw-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.

Approved. The updated quick start now shows one scan, with optional diagnostics explained separately.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Breezy!

Reviewed commit: 9c9e98bd54

ℹ️ 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".

Copilot AI 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.

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated no new comments.

Comments suppressed due to low confidence (1)

sdk/typescript/src/cli.ts:893

  • The scan --help text documents CODEX_SECURITY_LOG_LEVEL=debug but the implementation also supports a LOG_LEVEL=debug fallback (and CODEX_SECURITY_LOG_LEVEL precedence). This should be reflected in the option description so users discover the supported env var behavior from CLI help.
          verbose: z
            .boolean()
            .default(false)
            .describe(
              "Print redacted scan lifecycle diagnostics to stderr; CODEX_SECURITY_LOG_LEVEL=debug also enables this.",
            ),

@mldangelo-oai

Copy link
Copy Markdown
Collaborator Author

@codex review

Copilot AI 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.

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated no new comments.

@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: 3ec9ed8e67

ℹ️ 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 Outdated
@mldangelo-oai

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Nice work!

Reviewed commit: 7b75686837

ℹ️ 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".

Copilot AI 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.

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated no new comments.

Comments suppressed due to low confidence (1)

sdk/typescript/README.md:221

  • The README says "API keys, tokens, and raw provider messages are not printed", but verbose diagnostics explicitly include token counts (e.g., input/cached/output/cache-write tokens). This wording is misleading—consider clarifying that secret credentials are redacted while token counts/costs may be printed.
output. Diagnostics include CLI and runtime versions, the selected credential
source, requested reasoning effort, prepared scan output, worker phases and
capacity, classified connection retries, redacted scan warnings, cost updates,
completion, and runtime cleanup. API keys, tokens, and raw provider messages are
not printed. Use `--verbose --json` or

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. What shall we delve into next?

Reviewed commit: 18947972c0

ℹ️ 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".

…ty-scan-verbose

# Conflicts:
#	sdk/typescript/src/cli.ts
@mldangelo-oai

mldangelo-oai commented Jul 30, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

Please review exact pushed head 1b6f2f1, including the current-main merge, preserved verbose failure diagnostics, latest prefix-free CLI errors, and 108 focused passing CLI tests.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 👍

Reviewed commit: 1b6f2f1cb7

ℹ️ 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".

@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: ac8692ba32

ℹ️ 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 Outdated
ianw-oai
ianw-oai previously approved these changes Aug 3, 2026

@ianw-oai ianw-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.

Approved; one non-blocking documentation fix noted inline.

Comment thread README.md Outdated
@mldangelo-oai

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 🚀

Reviewed commit: 41af68f349

ℹ️ 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".

@chatgpt-codex-connector

Copy link
Copy Markdown

Security review completed. No security issues were found in this pull request.

Reviewed commit: 41af68f349

View security finding report

Only the user who started this review can view the report in Codex.

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

ianw-oai
ianw-oai previously approved these changes Aug 3, 2026
@mldangelo-oai

Copy link
Copy Markdown
Collaborator Author

@codex review exact head 5323298

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. What shall we delve into next?

Reviewed commit: 53232989d0

ℹ️ 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".

@chatgpt-codex-connector

Copy link
Copy Markdown

Security review completed. No security issues were found in this pull request.

Reviewed commit: 53232989d0

View security finding report

Only the user who started this review can view the report in Codex.

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

@mldangelo-oai
mldangelo-oai merged commit 7b7e031 into main Aug 3, 2026
15 checks passed
@mldangelo-oai
mldangelo-oai deleted the mdangelo/codex/security-scan-verbose branch August 3, 2026 23:08
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.

4 participants