Skip to content

CM-73887: add Diff scan scope to the Scan view - #172

Open
aaron-butler-cy-int wants to merge 2 commits into
cycodehq:mainfrom
aaron-butler-cy-int:CM-73887---Adding-support-for-diff-scanning
Open

aaron-butler-cy-int wants to merge 2 commits into
cycodehq:mainfrom
aaron-butler-cy-int:CM-73887---Adding-support-for-diff-scanning

Conversation

@aaron-butler-cy-int

Copy link
Copy Markdown

Adds a Project / Diff / File scan scope selector. Diff compares two git revisions, or the uncommitted working directory against one:

  • two revisions run commit-history --commit-range from...to
  • one side set to "Local directory" runs pre-commit --include-unstaged --base-ref <ref> --path <path>
  • IaC is unsupported by the CLI for both flavors, so it falls back to a full project scan while the other scan types are diffed

The revision dropdowns list branches, tags and recent commits via a new GitService, stay current through the vscode.git API (with a .git file watcher fallback), and keep a stored selection that has scrolled out of the list. The Diff scope is hidden and refused below Cycode CLI 3.25.0.

Paths and git refs are validated before being passed to the CLI, which is spawned with shell: true.

Adds a Project / Diff / File scan scope selector. Diff compares two
git revisions, or the uncommitted working directory against one:

- two revisions run `commit-history --commit-range from...to`
- one side set to "Local directory" runs
  `pre-commit --include-unstaged --base-ref <ref> --path <path>`
- IaC is unsupported by the CLI for both flavors, so it falls back to a
  full project scan while the other scan types are diffed

The revision dropdowns list branches, tags and recent commits via a new
GitService, stay current through the vscode.git API (with a .git file
watcher fallback), and keep a stored selection that has scrolled out of
the list. The Diff scope is hidden and refused below Cycode CLI 3.25.0.

Paths and git refs are validated before being passed to the CLI, which
is spawned with shell: true.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Resolves the conflicts in cli-service.ts with upstream's changes:

- The CLI is no longer spawned with `shell: true`, so paths are passed as
  plain argv elements. The shell-metacharacter validator and the path
  quoting (utils/shell-arg.ts) are replaced by utils/git-ref-arg.ts, which
  only rejects refs that would be read as an option or contain control
  characters. Valid project paths such as "R&D" or "My Project (2)" are
  no longer refused.
- processCliScanResult now takes the scanned paths and drops detections
  outside of them; the shared runScanAndProcessResults helper passes the
  scanned paths for path, commit-range and pre-commit scans.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant