Skip to content

feat(cli): browse historical security findings - #275

Open
mldangelo-oai wants to merge 66 commits into
mainfrom
mdangelo/codex/findings-history-discovery
Open

feat(cli): browse historical security findings#275
mldangelo-oai wants to merge 66 commits into
mainfrom
mdangelo/codex/findings-history-discovery

Conversation

@mldangelo-oai

@mldangelo-oai mldangelo-oai commented Aug 4, 2026

Copy link
Copy Markdown
Collaborator

Summary

Add repository-scoped historical finding discovery while preserving checkout ownership, finding triage, and completed-scan integrity.

Changes

  • Browse current and historical findings with repository or scan selection, filters, pagination, finding details, and latest-scan shortcuts.
  • Show clear Fixed, False Positive, and Ignored finding labels without changing stored statuses or machine-readable results.
  • Keep saved finding matches and triage consistent across verified linked worktrees, finding details, and scan-specific lists.
  • Reject matches between independently registered sibling targets and preserve ownership epochs when a checkout moves, disappears, or is replaced.
  • Keep previous-owner, unverified-clone, and claimed targetless findings outside the current repository boundary.
  • Use SQLite insertion order for finding history, matching, triage, and reopened findings when system clocks move backward.
  • Preserve sealed-artifact validation, coverage-aware resolution, existing JSON pagination, and interactive history output.

Testing

  • Focused findings, ownership, linked-worktree, sibling-target, renderer, and CLI suites: 76 tests passed across six files.
  • Full randomized SDK suite: 1,132 passed, 11 platform or optional integration tests skipped, and zero failed.
  • pnpm --pm-on-fail=ignore run types passed.
  • pnpm --pm-on-fail=ignore run format passed.
  • Python syntax validation passed for all five affected workbench modules.
  • git diff --cached --check passed.

Risk and rollout

This extends saved-history commands and bundled workbench indexes. Existing credential handling, scan execution, completed artifacts, checkout ownership verification, stored statuses, and sealed-artifact rejection remain unchanged. No database migration or release-version change is required.

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 Aug 4, 2026
@mldangelo-oai
mldangelo-oai requested a review from Copilot August 4, 2026 07:23
@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

This PR adds first-class CLI support for browsing historical scan findings, including repository-scoped and scan-scoped finding lists, a dedicated finding-details view, and improved scan-history rendering that makes follow-up actions (pagination, details, matching, comparison) more discoverable.

Changes:

  • Introduces codex-security findings list / findings show flows (plus findings defaulting to list) and enhances scans show to support a “latest completed scan” default.
  • Extends the TypeScript renderer to format saved-findings pages and full finding details (locations, evidence, remediation guidance, history links, pagination hints).
  • Expands the bundled Python workbench to support get-finding, richer scan-history scoping for moved/nested checkouts, and global findings indexing improvements (including secondary-location search).

Reviewed changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
sdk/typescript/tests-ts/workbench-findings-index.test.ts Adds regression coverage for global findings indexing (scoping, filtering, coverage-read behavior, tamper/noncanonical handling, detail vs preview completeness).
sdk/typescript/tests-ts/scan-history-renderer.test.ts Adds renderer coverage for actionable findings/history output, pagination hints, triage precedence, and next-command suggestions.
sdk/typescript/tests-ts/runtime.test.ts Adds coverage ensuring large get-finding responses are allowed while oversize non-detail workbench responses fail safely without leaking content.
sdk/typescript/tests-ts/cli.test.ts Updates CLI manifest assertions for new findings commands and revised scans show signature.
sdk/typescript/tests-ts/cli-findings.test.ts Adds CLI tests for repository scoping, paging/filter validation, scan selection, and “latest scan” behavior.
sdk/typescript/src/scan-history-renderer.ts Implements new findings/finding render modes, checkout scoping helpers, and improved list/show guidance (pagination, matching, compare suggestions).
sdk/typescript/src/runtime.ts Adds separate workbench stdout limits for list-style commands vs get-finding, with safer maxBuffer error redaction.
sdk/typescript/src/cli.ts Adds findings list/show commands, defaults findings/scans to list, and supports scans show without an explicit scan ID (latest completed).
sdk/typescript/README.md Documents the new scan-history and findings browsing commands and how to page/filter results.
sdk/typescript/_bundled_plugin/scripts/workbench_scan_history.py Improves repository scoping to handle moved checkouts, nested boundaries, and reused paths more safely; includes currentTargetPath projection.
sdk/typescript/_bundled_plugin/scripts/workbench_native_indexes.py Adds multi-target support, legacy-path support, and secondary-location searching for global findings queries.
sdk/typescript/_bundled_plugin/scripts/workbench_db.py Adds get-finding, supports full-details finding serialization, and strips forged metadata fields from stored details while preserving authoritative triage.
sdk/typescript/_bundled_plugin/scripts/workbench_cli.py Extends the workbench CLI surface with get-finding and multi-valued --target-id/--target-path for global findings.
README.md Updates top-level docs to mention scans show latest behavior and the new findings browsing commands.

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

Comment thread sdk/typescript/_bundled_plugin/scripts/workbench_scan_history.py Outdated
Comment thread sdk/typescript/_bundled_plugin/scripts/workbench_native_indexes.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: 223ecf3e75

ℹ️ 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/_bundled_plugin/scripts/workbench_scan_history.py Outdated
Comment thread sdk/typescript/src/scan-history-renderer.ts Outdated
Comment thread sdk/typescript/src/scan-history-renderer.ts Outdated
@chatgpt-codex-connector

Copy link
Copy Markdown

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

Reviewed commit: 223ecf3e75

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 requested a review from Copilot August 4, 2026 08:11
@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 14 out of 14 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: f0dc21af02

ℹ️ 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 thread sdk/typescript/src/runtime.ts Outdated
@chatgpt-codex-connector

Copy link
Copy Markdown

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

Reviewed commit: f0dc21af02

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

Copy link
Copy Markdown
Collaborator Author

@codex review

@mldangelo-oai

Copy link
Copy Markdown
Collaborator Author

@codex security review

@chatgpt-codex-connector

Copy link
Copy Markdown

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

Reviewed commit: 36196d8552

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.

@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: 36196d8552

ℹ️ 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/_bundled_plugin/scripts/workbench_native_indexes.py Outdated
@mldangelo-oai

Copy link
Copy Markdown
Collaborator Author

@codex review

@mldangelo-oai

Copy link
Copy Markdown
Collaborator Author

@codex security review

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

ℹ️ 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/_bundled_plugin/scripts/workbench_native_indexes.py
Comment thread sdk/typescript/src/scan-history-renderer.ts
Comment thread sdk/typescript/_bundled_plugin/scripts/workbench_db.py
@chatgpt-codex-connector

Copy link
Copy Markdown

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

Reviewed commit: f7a00cd90b

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

Copy link
Copy Markdown
Collaborator Author

@codex review

@mldangelo-oai

Copy link
Copy Markdown
Collaborator Author

@codex security review

@chatgpt-codex-connector

Copy link
Copy Markdown

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

Reviewed commit: 94d3e467b2

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.

@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: 94d3e467b2

ℹ️ 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/_bundled_plugin/scripts/workbench_db.py Outdated
Comment thread sdk/typescript/_bundled_plugin/scripts/workbench_native_indexes.py
Comment thread sdk/typescript/_bundled_plugin/scripts/workbench_scan_history.py
@mldangelo-oai

Copy link
Copy Markdown
Collaborator Author

@codex review

@mldangelo-oai

Copy link
Copy Markdown
Collaborator Author

@codex security review

@chatgpt-codex-connector

Copy link
Copy Markdown

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

Reviewed commit: 54d4964db0

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.

@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: 54d4964db0

ℹ️ 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/_bundled_plugin/scripts/workbench_db.py
Comment thread sdk/typescript/_bundled_plugin/scripts/workbench_db.py Outdated
Comment thread sdk/typescript/_bundled_plugin/scripts/workbench_db.py
@mldangelo-oai

Copy link
Copy Markdown
Collaborator Author

@codex review

@mldangelo-oai

Copy link
Copy Markdown
Collaborator Author

@codex security review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Another round soon, please!

Reviewed commit: dc8f65611c

ℹ️ 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: dc8f65611c

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.

@zcrab-oai zcrab-oai left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

One concrete historical-finding identity issue remains; details are in the inline comment.

Comment thread sdk/typescript/_bundled_plugin/scripts/workbench_native_indexes.py
@mldangelo-oai

Copy link
Copy Markdown
Collaborator Author

@codex review

@mldangelo-oai

Copy link
Copy Markdown
Collaborator Author

@codex security review

@chatgpt-codex-connector

Copy link
Copy Markdown

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

Reviewed commit: bfc7da4f1e

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.

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

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

),
}
)
combined.extend(active.values())

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 aggregate triage for targetless scan history

When a pre-target migration database has the same finding ID in multiple targetless scans and an older occurrence was closed, this fallback appends the latest active row without aggregation because _indexed_findings inner-joins security_targets. The finding consequently reappears as open and loses its known-scan history even though its occurrenceCount includes the older occurrence; saved semantic matches between legacy scans have the same problem. Include targetless occurrences in aggregation using a repository-path-scoped identity rather than returning them only through this fallback.

AGENTS.md reference: sdk/typescript/AGENTS.md:L16-L16

Useful? React with 👍 / 👎.

Comment on lines +535 to +536
"confirmed_in_latest_scan": (
completed_scans[0]["id"] == row["scan_id"] if completed_scans else True

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 Include unsealed scans in latest-scan confirmation

When an upgraded database contains completed scans created before the sealed-manifest migration, their seal_manifest_digest remains NULL until each scan is explicitly backfilled, so they are absent from completed_scans_by_target even though their occurrences are still queried below. If a later such scan omits an older finding, this fallback reports the old occurrence as confirmedInLatestScan: true; use all completed scans to determine confirmation while restricting only coverage reads to sealed scans.

AGENTS.md reference: sdk/typescript/AGENTS.md:L23-L23

Useful? React with 👍 / 👎.

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