Skip to content

fix(scan): detect credentials exposed in source - #1134

Merged
mldangelo-oai merged 40 commits into
mainfrom
mdangelo/codex/source-secret-discovery
Oct 3, 2026
Merged

mldangelo-oai merged 40 commits into
mainfrom
mdangelo/codex/source-secret-discovery

Conversation

@mldangelo-oai

@mldangelo-oai mldangelo-oai commented Sep 30, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Credentials embedded in current source can expose access even when their containing code is unused or lives in a test. Teach the scan workflow to assess this source-reader disclosure path offline, retain the original evidence, and distinguish supported exposures from placeholders and public material.

Changes

  • Apply the credential-discovery guidance to the core audit, baseline auditor, and focused investigators, with source access and uncertain live validity reflected in the finding.
  • Add a generated-source eval with six credential cases and negative controls. Grade retained findings, applicable classifications, exact source evidence, and complete coverage without giving the model gold labels.
  • Reuse the native account and permission preflight, isolate eval state and model tools, and preserve saved-login refreshes and authentication precedence. Use the shared permission-profile identifier after merging main so the eval accepts its configured profile and detects runtime fallback.
  • Share the bundled SDK environment helper while preserving Unix PATH behavior and Windows path aliases. Add deterministic eval checks to CI.

Testing

  • Passed all 135 deterministic secret-discovery eval checks, including native child-process authentication precedence, exact evidence preservation, profile rejection, fallback cancellation, and cleanup.
  • Passed all 54 focused SDK checks for custom validation, CLI diagnostics, and errors.
  • Passed SDK build:ci, types, and format.
  • Passed Ruff 0.16.9 check and format checks, plugin source compatibility, and all 9 source-checker tests.
  • Three independent native reviews and fresh verification found no actionable regressions on the final integrated commit.
  • Full seeded SDK suite: 3,438 passed, 53 skipped, and 11 failures caused by the host working-directory Git marker. All 73 authentication tests passed unchanged from an isolated working directory.
  • Full randomized SDK suite: 3,448 passed, 53 skipped, and one TUI subprocess import failure caused by the isolated working directory. That test passed unchanged from the package directory. No unexplained full-suite failures remain.
  • The optional model-backed eval was not run during this update. Deterministic checks verify the harness and grading behavior; they do not measure model recall.

Risk and rollout

The production change is scan guidance. It retains source evidence and existing credential-access controls, and it does not use discovered credentials or validate them against services. The optional eval runs in isolated temporary state with offline, read-only model tools. No public CLI command, flag, environment variable, or default is added or changed.

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.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 30, 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-03T01:18:55.568874Z 7445c28 New commits
🔒 Security Review ✅ Completed 2026-10-03T01:19:07.355331Z 7445c28 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: af768f5c7a

ℹ️ 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 evals/secret-discovery/harness.mjs Outdated
Comment thread evals/secret-discovery/grade.mjs Outdated
Comment thread evals/secret-discovery/grade.mjs Outdated
Comment thread evals/secret-discovery/grade.mjs Outdated
@github-actions github-actions Bot added the bug Something isn't working label Sep 30, 2026
@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.

Copilot review overview

🟡 Changes recommended

Whitespace-only Codex credentials incorrectly suppress the valid OpenAI authentication fallback.

Review effort: Balanced
Findings: 1 Medium severity

Open (1)
What changed in this PR

Adds source-level credential detection to security scans and a synthetic evaluation suite to verify discovery, redaction, coverage, and runtime isolation.

Changes:

  • Extends audit prompts to treat exposed credentials as standalone findings.
  • Adds deterministic secret-discovery fixtures, grading, runtime safeguards, and tests.
  • Runs deterministic checks in CI and refreshes the workflow compatibility hash.
File Description
.github/​workflows/​node-ci.yml Runs secret-discovery contract tests.
evals/​README.md Documents the new evaluation.
evals/​secret-discovery/​.gitignore Excludes generated reports.
evals/​secret-discovery/​README.md Documents evaluation behavior and usage.
evals/​secret-discovery/​fixtures.mjs Generates synthetic credential fixtures.
evals/​secret-discovery/​grade.mjs Grades discovery, coverage, and redaction.
evals/​secret-discovery/​harness.mjs Configures and executes evaluation turns.
evals/​secret-discovery/​run.mjs Provides the model-evaluation entry point.
evals/​secret-discovery/​runtime.mjs Manages preflight, signals, and cleanup.
evals/​secret-discovery/​test_discovery.mjs Tests grading and harness contracts.
evals/​secret-discovery/​test_runtime.mjs Tests native runtime safeguards.
plugins/​codex-security/​references/​core-scan.md Adds source-secret review guidance.
sdk/​typescript/​src/​custom-validation-prompt.ts Refreshes the workflow hash.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread evals/secret-discovery/harness.mjs Outdated

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

ℹ️ 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 plugins/codex-security/references/core-scan.md Outdated
@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.

Copilot review overview

🟢 Approval recommended

The prompt hash is correct and the new behavior is covered by comprehensive deterministic tests.

Review effort: Balanced
Findings: None

Resolved since last review (1)

@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: 85874fa914

ℹ️ 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 evals/secret-discovery/grade.mjs Outdated

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

Reviewed the prompt changes, isolated evaluation harness, fixtures, grader, authentication/fallback checks and cancellation cleanup. The existing Windows-path issue remains applicable at this head: grade.mjs strips './' but does not normalize backslashes, so a correct src\client.py location is missed and counted as a false positive. Please address #1134 (comment) before approval. No additional finding; hosted node-ci is green, but this missing grading case is not covered. No local or live-model tests run.

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

Copilot review overview

🔵 Needs a closer look

Whitespace-only CODEX_HOME values can bypass the default saved login and break evaluation authentication.

Review effort: Balanced
Findings: None

Previously missed (1)

In code that hasn't changed since last review

Medium severity Treat whitespace-only CODEX_HOME as unset

evals/​secret-discovery/​run.mjs:27

Treat whitespace-only CODEX_HOME as unset, as the SDK does in sdk/typescript/src/auth.ts:33-38. Currently a value such as CODEX_HOME=" " resolves to that literal relative directory, so the eval misses the default saved login and can fail authentication instead of using ~/.codex.

@chatgpt-codex-connector

Copy link
Copy Markdown

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

Reviewed commit: c701d95439

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

Copilot review overview

🔵 Needs a closer look

The new masking contract conflicts with the repository’s explicit policy against wrapper-owned credential redaction.

Review effort: Balanced
Findings: None

Previously missed (2)

In code that hasn't changed since last review

Medium severity Stop grader from requiring credential masking

evals/​secret-discovery/​grade.mjs:208

The grader makes credential masking a pass condition, thereby enforcing the wrapper-owned redaction policy prohibited by AGENTS.md:49-62; that policy specifically requires preserving diagnostic/report text and not replacing credential-shaped content solely because it may be sensitive. Remove this leakage failure condition and align the prompt and eval documentation accordingly.

Low severity Remove credential redaction from saved scan drafts

plugins/​codex-security/​references/​core-scan.md:12

This new requirement redacts credential text before saving scan drafts, which conflicts with the repository policy in AGENTS.md:49-62 prohibiting wrapper-owned credential redaction in saved diagnostics, reports, and summaries. Remove this masking requirement and preserve the source-backed diagnostic payload; the corresponding eval/docs that enforce masking must be updated as part of the same change.

This issue also appears in the following locations of the same file:

  • line 28
  • line 66
  • line 88

@mldangelo-oai

mldangelo-oai commented Oct 2, 2026 •

Copy link
Copy Markdown
Collaborator Author

Corrected in b4a5f65. Both items in Copilot’s review identify a policy conflict: the pre-persistence instruction transforms returned worker evidence, and the eval enforces that masking contract.

The update removes the added masking requirements and grading checks. Offline credential discovery, original finding evidence, saved-login support, and existing authentication, access, storage, and publication controls remain intact. All 125 deterministic eval tests passed, including raw-result preservation through the SDK child-process boundary, along with focused SDK tests, all five portable plugin checks, types, formatting, and installed-package checks.

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

Copilot review overview

🟡 Changes recommended

The grader can accept fabricated evidence text without verifying it against the cited source.

Review effort: Balanced
Findings: 1 Medium severity

Open (1)

Comment thread evals/secret-discovery/grade.mjs

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

ℹ️ 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 evals/secret-discovery/grade.mjs Outdated
@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.

Copilot review overview

🔵 Needs a closer look

It combines security-prompt behavior with authentication, sandbox, and child-process changes that warrant final human review.

Review effort: Balanced
Findings: None

Resolved since last review (1)

@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: 19d61942b7

ℹ️ 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 evals/secret-discovery/harness.mjs 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. Already looking forward to the next diff.

Reviewed commit: eb4d27f0e5

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

Copilot review overview

🔵 Needs a closer look

The combined security-prompt, authentication, permission, and cross-platform runtime changes warrant final human review.

Review effort: Balanced
Findings: None

@kmbroai kmbroai 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.

Reviewed the current-source credential guidance and eval. All 135 deterministic eval tests, SDK types, and source checks pass locally; full CI passed on this head. These checks do not establish model recall.

One integration requirement before combining with #1193: the eval uses discovery_eval, while that cleanup hardcodes codex_security_deep_scan_worker in the shared preflight/fallback helpers. The existing native-preflight eval test passes here and fails with the cleanup helper. Preserve configurable profile IDs or update the eval's profile configuration and callers together.

@mldangelo-oai
mldangelo-oai merged commit 61505e7 into main Oct 3, 2026
164 of 190 checks passed
@mldangelo-oai
mldangelo-oai deleted the mdangelo/codex/source-secret-discovery branch October 3, 2026 06:33
@github-actions github-actions Bot mentioned this pull request Oct 3, 2026
3 tasks done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants