Skip to content

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

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

feat(cli): browse historical security findings#275
mldangelo-oai wants to merge 43 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 finding lists, individual finding details, filters, pagination, and a latest-scan shortcut.
  • Preserve completed scan history across verified related Git worktrees while rejecting reused paths, unregistered moves, cross-checkout comparisons, and unverifiable checkout identities.
  • Keep legacy history readable, but require recorded filesystem identities before explicit or bulk comparisons and verify registration of both Git worktrees.
  • Keep canonical finding evidence, triage state, remediation guidance, and sealed-artifact validation intact.
  • Merge current main and remove obsolete workbench output limits and redundant large-output tests.

Verification

  • bun test tests-ts/workbench-findings-index.test.ts tests-ts/workbench-scan-history.test.ts tests-ts/cli-findings.test.ts (38 passed).
  • Full SDK suite: 1,039 passed, 11 skipped, 0 failed.
  • SDK type and formatting checks.

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

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. More of your lovely PRs please.

Reviewed commit: 55c7a93ddc

ℹ️ 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: 55c7a93ddc

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 the exact current head 25ddb3e. Verify strict ownership for finding-source reads and explicit scan comparisons, registered sibling worktrees, cache correctness, and the existing supported remediation behavior after filesystem remounts.

@chatgpt-codex-connector

Copy link
Copy Markdown

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

Reviewed commit: 25ddb3e6cf

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: 25ddb3e6cf

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

Copy link
Copy Markdown
Collaborator Author

@codex review the exact current head 70584fa. Verify ownership before comparing same-ID and different-ID linked worktrees, strict finding-source isolation, verified sibling history, matching cache, and remount-compatible remediation.

@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: 70584fa064

ℹ️ 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
@chatgpt-codex-connector

Copy link
Copy Markdown

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

Reviewed commit: 70584fa064

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 the exact current head cf41147. Verify current filesystem ownership before all same-owner, different-owner, and linked-worktree comparisons, while preserving legitimate history, cache behavior, and remount-compatible remediation.

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

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

Copy link
Copy Markdown

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

Reviewed commit: cf4114728d

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 the exact current head 3dbb6d8. Verify explicit comparisons require recorded ownership, stale same-owner and linked-worktree scans fail closed, ordinary legacy listing remains available, and remediation retains its separate remount compatibility.

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

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

Copy link
Copy Markdown
Collaborator Author

@codex review the exact current head 927c3d8. Focus on explicit historical-comparison ownership, symmetric worktree registration, legacy read-only history, and checkout identity isolation.

@chatgpt-codex-connector

Copy link
Copy Markdown

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

Reviewed commit: 927c3d8c44

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: 927c3d8c44

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

Copy link
Copy Markdown
Collaborator Author

@codex review the exact current head d43fc52. Focus on ownership verification before both explicit and bulk finding comparisons, preserving read-only legacy history and matching-input caching.

@chatgpt-codex-connector

Copy link
Copy Markdown

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

Reviewed commit: d43fc52054

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: d43fc52054

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

Copy link
Copy Markdown
Collaborator Author

@codex review the exact current head beea727. Verify legacy scans remain visible in read-only history while explicit and bulk finding comparisons still require verified checkout ownership.

@chatgpt-codex-connector

Copy link
Copy Markdown

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

Reviewed commit: beea72727d

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

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.

Validated review findings are attached inline after three independent reviews and a separate source-level verification.

get_scan.add_argument("--scan-id", required=True)
get_scan.add_argument("--occurrence-id")

get_finding = subparsers.add_parser("get-finding")

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.

[P1] Version the changed bundled workbench before installing it

This PR changes multiple packaged workbench modules but leaves the bundled plugin manifest and BUNDLED_PLUGIN_VERSION at 0.1.16. bootstrapPlugin() reuses an existing installed plugin solely on matching name/version, and the installed MCP server resolves workbench_db.py from its own cached PLUGIN_ROOT. The standalone CLI reads the fresh bundle, but installed Codex/MCP tools retain the old workbench, creating divergent history and findings behavior. Bump both plugin version declarations so installed copies are refreshed.

)
current_owner_only += (
" AND (scans.target_id IS NULL OR ("
f"scans.target_device IS (SELECT ownership_scan.target_device {latest_identity}) "

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.

[P1] Keep migrated findings whose historical scans lack filesystem identities

Migration 9 adds nullable target_device and target_inode without backfilling existing scans. Once a newer scan records a non-null identity for the same target, this equality filter removes every older null-identity scan from the active findings index, so unresolved historical findings disappear even when the checkout never changed. list_scans() explicitly preserves rows where both identity fields are null, but this index does not; its main test fixture also omits both identity columns and never exercises this production branch. Preserve verified-target legacy rows in read-only findings queries.

if before["status"] != "complete" or after["status"] != "complete":
raise SystemExit("Only completed scans can be compared.")
if not _same_repository(before, after):
if not _same_repository(before, after, require_ownership=True):

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.

[P2] Resolve relocated checkout paths before comparing historical scans

After a checkout is legitimately moved and security_targets.current_path is updated, old scan rows still contain the original nonexistent target_path. _same_repository() stats that stale path before checking the shared target identity, so this call and the equivalent check in save_scan_comparison() reject valid comparisons. list_unmatched_scan_pairs() already joins the registered current path and passes it to _same_repository(), which means bulk matching can select moved scans but then fail when saving them. Verify both historical scans against their registered current checkout paths.

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