Skip to content

feat(validation): validate findings after a scan - #1007

Open
mldangelo-oai wants to merge 74 commits into
mainfrom
mdangelo/codex/scan-validate
Open

mldangelo-oai wants to merge 74 commits into
mainfrom
mdangelo/codex/scan-validate

Conversation

@mldangelo-oai

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

Copy link
Copy Markdown
Collaborator

Summary

Add optional standalone validation after a completed source scan, with supplemental assessments that remain tied to the scanned target and evidence.

Changes

  • Add cs scan [repository] --validate, disabled by default. Preserve the chosen plugin directory or ZIP, Python runtime, Cyber access program, and captured knowledge inputs.
  • Save completed assessments and a supplemental report across interruption and retry without rewriting the scan's findings or severity policy.
  • Bind cached assessments to the recorded target, source, evidence, request settings, and the exact standalone instructions used by validation.
  • Merge the reviewed main snapshot, reuse its shared parsers/runtime helpers, and retain read-only, offline standalone validation and current source-scan outcomes.
  • Keep validation failures and interruptions in full-output JSON/JSONL error envelopes while retaining completed scan data and diagnostic text.
  • Keep completed target checks and original validation failures intact when temporary plugin cleanup or later client shutdown fails. Mandatory credential/runtime cleanup failures remain errors when there is no earlier validation failure.

Testing

  • All five portable plugin checks, SDK types and formatting, and the bundled plugin build passed.
  • Focused API validation/workflow tests: 92 passed. Both affected CLI test files: 218 passed, including validation failure/interruption envelopes and cleanup-failure regressions. Five new regression cases failed before the cleanup fixes and passed afterward. The inline-instruction cache regression and all three affected empty-target cases also passed.
  • Python finding-workflow/scan-validation tests: 37 passed. MCP executor/artifact-recovery tests, including fresh and resumed workers: 182 passed.
  • SDK/MCP types, full formatting, and the CI helper build were repeated after the cleanup fixes: passed. Three fresh native reviews and an independent verifier found no introduced actionable issues on the corrected head.
  • Final-head full SDK runs with seed 12345 and explicit randomization are running in separate neutral test environments. An earlier run was stopped after 3,641 passes and 11 checkout-layout-dependent authentication fixture failures; all 12 focused authentication controls passed from an isolated working directory. A separate unchanged TUI fixture fails when the neutral working directory resolves different dependency copies; its whole test file passes 9/9 with the frozen SDK dependencies. The final randomized run uses those frozen dependencies. No full-suite or live-model completion is claimed here.

Risk and rollout

Existing scans are unchanged unless --validate is selected. Validation is supplemental and not cost-tracked, so it cannot be combined with --dry-run, --mock, or a scan cost limit such as --max-cost. A validation failure returns exit code 2 while preserving completed scan data and assessments, and prevents subsequent patch generation. The cache contract changes once to invalidate assessments made under older instruction binding.

Public disclosure review

Reviewed the current branch, title, description, commits, changes, PR discussion, available Actions logs and artifacts, and current Code Scanning reports. No sensitive additions were found. Historical Code Quality analysis bodies remain outside this review, so the full-disclosure attestations remain unchecked.

  • 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 Sep 23, 2026
@mldangelo-oai
mldangelo-oai marked this pull request as ready for review September 23, 2026 19:08
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 23, 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-16T05:05:21.843717Z fc5c4a8 New commits
🔒 Security Review ✅ Completed 2026-10-16T05:06:55.278823Z fc5c4a8 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: 5943f48930

ℹ️ 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 Outdated
Comment thread sdk/typescript/tests-ts/cli.test.ts Outdated
@mldangelo-oai mldangelo-oai changed the title feat(cli): run standalone validation after scan feat(cli): add opt-in standalone validation after scans Sep 30, 2026

@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: 798b0af278

ℹ️ 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/scripts/workbench_target.py 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: 9b700bbc8c

ℹ️ 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/api.ts 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: 7bc64dd65d

ℹ️ 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/api.ts
@mldangelo-oai
mldangelo-oai requested a balanced review from Copilot October 12, 2026 02:14
@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.

🟡 Changes recommended

Zero-finding validation ignores the scan’s selected custom plugin runtime.

1 open finding
What changed in this PR

Adds optional post-scan finding validation with durable evidence, cache integrity checks, and target revalidation.

Changes:

  • Adds scan --validate, reporting, retry, failure, and interruption handling.
  • Binds cached assessments to source, settings, knowledge, and evidence.
  • Extends workbench target checks and comprehensive validation tests.
File Description
sdk/​typescript/​src/​api.ts Implements validation caching and integrity checks.
sdk/​typescript/​src/​cli.ts Adds the --validate scan workflow.
sdk/​typescript/​src/​knowledge-base.ts Shares protected-root resolution.
sdk/​typescript/​src/​finding-workflow.ts Extends workflow snapshot and review APIs.
sdk/​typescript/​src/​deduplication/​scan.ts Adopts snapshot option objects.
sdk/​typescript/​src/​deduplication/​checkpointed-review.ts Updates source verification calls.
sdk/​typescript/​docs/​cli.md Documents follow-up validation.
sdk/​typescript/​tests-ts/​api.test.ts Tests validation caching and isolation.
sdk/​typescript/​tests-ts/​cli.test.ts Tests CLI validation behavior.
sdk/​typescript/​tests-ts/​cli-scan-validation.test.ts Adds target and runtime validation tests.
sdk/​typescript/​tests-ts/​cli-project-config.test.ts Tests Cyber setting propagation.
sdk/​typescript/​tests-ts/​cli-fixtures.ts Adds validation test fixtures.
sdk/​typescript/​tests-ts/​cli-scan-failures.test.ts Updates failing client fixtures.
sdk/​typescript/​tests-ts/​component-scan.test.ts Completes mock client behavior.
sdk/​typescript/​tests-ts/​sdk-project-config.test.ts Exposes validation in test clients.
plugins/​codex-security/​scripts/​workbench_target.py Adds target and evidence integrity checks.
plugins/​codex-security/​scripts/​workbench_finding_workflows.py Supports optional snapshots and cache replacement.
plugins/​codex-security/​scripts/​workbench_db.py Enforces target checks during lookup.
plugins/​codex-security/​scripts/​workbench_cli.py Adds get-scan --check-target.
plugins/​codex-security/​tests/​test_workbench_scan_validation.py Tests recorded-target validation.
plugins/​codex-security/​tests/​test_workbench_finding_workflows.py Tests evidence snapshots and replacement.
plugins/​codex-security/​mcp-app/​tests/​test_deep_scan_executor.ts Extends Cyber program coverage.
plugins/​codex-security/​mcp-app/​tests/​test_artifact_scan_draft_recovery.ts Stabilizes recovery timestamp fixtures.

🧠 Review effort: Balanced


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

Comment thread sdk/typescript/src/cli.ts

@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: 910ef401b7

ℹ️ 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/api.ts Outdated
@mldangelo-oai mldangelo-oai changed the title feat(validation): add optional follow-up validation for scan findings feat(validation): validate findings after a scan Oct 12, 2026
@mldangelo-oai
mldangelo-oai requested a balanced review from Copilot October 12, 2026 04:01
@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. Another round soon, please!

Reviewed commit: 205a697129

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

🔵 Needs a closer look

Cached implicit evidence can bypass output ownership and permission validation.

0 open findings

1 resolved since last review
Previously missed (1)

In code that hasn't changed since last review

Medium severity Cached implicit evidence skips output-directory security validation

sdk/​typescript/​src/​api.ts:990

Cached implicit evidence bypasses the output-directory ownership and permission checks. sourceSnapshot(..., { evidence: true }) fingerprints descendants but not the root directory's mode, UID, or secure ancestry, so changing a default evidence directory to 0777 (or changing its owner/ancestor permissions) still allows this assessment to be reused. Explicit outputs are protected because #prepareLocalInputs calls validateOutputDir, but inputs.outputDir === null never validates the cached assessment.outputDir. Validate that cached path with the existing output-directory checks before accepting its digest; for an invalid implicit path, treat the cache as unusable and regenerate into a private directory.

🧠 Review effort: Balanced

@mldangelo-oai
mldangelo-oai requested a balanced review from Copilot October 12, 2026 04:47
@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: 783128384d

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

🔵 Needs a closer look

Target and evidence integrity checks can miss sparse-checkout and Windows-junction changes.

0 open findings

Previously missed (2)

In code that hasn't changed since last review

Medium severity Directory junction retargeting is missing from evidence fingerprints

plugins/​codex-security/​scripts/​workbench_finding_workflows.py:165

This evidence fingerprint does not detect a Windows directory junction being retargeted. The helper stops traversal at reparse-point directories, but directory_content_digest() only records os.readlink() when stat.S_ISLNK() is true; a junction is reported as a directory with a reparse tag, so its target is omitted from the digest. A cached assessment can therefore be reused after an evidence link changes destinations; hash the reparse target itself while continuing not to traverse it.

Medium severity Sparse checkout can bypass committed-diff validation

plugins/​codex-security/​scripts/​workbench_target.py:469

The target check can accept a committed-diff checkout that was made sparse after the scan. worktree_content_digest() hashes git diff HEAD and untracked files, but Git reports no diff for omitted skip-worktree files, so the HEAD and digest still match while validation runs with tracked source files missing. Recheck for S entries from git ls-files -t -z (or otherwise bind the full-checkout state) before accepting committed-diff validation.

🧠 Review effort: Balanced

@zcrab-oai zcrab-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 changes since the previous reviewed head in two passes, using exact source at 783128384d1d and prior review evidence. Unchanged portions of the large branch were not exhaustively re-audited.

Approved. No new actionable findings in the reviewed scope.

Validation: CI-helper TypeScript compilation and plugin bundling passed locally; native binaries came from CI with matching compiled source inputs. Focused Python tests passed: test_workbench_scan_validation.py (10 passed in 12.22s). The full cross-platform suite was not run locally; Windows execution remains unverified here.

@alandelong-oai alandelong-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 actual diff at 783128384d1d32b400b78828e9862e280b6caee5 in three independent passes, including the API/CLI tests and the saved-source and target checks. Optional validation keeps the target and evidence tied to the recorded scan, preserves completed supplemental assessments on partial failure, and prevents patch generation after a validation failure. Budget, dry-run, and mock restrictions are explicit; validation cost is documented separately.

No blocking findings. Static review only; no model calls, scan execution, or suites rerun.

@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: 2f8b3e7ebf

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

This branch has not been deployed

No deployments
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.

5 participants