Skip to content

CM-72593: Surface malicious package detections in SCA scan output - #545

Merged
omer-roth merged 3 commits into
cycodehq:mainfrom
AradTraub:CM-72593-malicious-package-cli-output
Nov 1, 2026
Merged

omer-roth merged 3 commits into
cycodehq:mainfrom
AradTraub:CM-72593-malicious-package-cli-output

Conversation

@AradTraub

@AradTraub AradTraub commented Sep 14, 2026 •

Copy link
Copy Markdown
Contributor

Renders the "Malicious package found" SCA policy (1fe6d83a-19de-48a2-a5ba-a80fe648489b) in scan output, and adds the scan option needed for the backend to run the detector at all.

Mirrors CM-68446 (unmaintained packages), which is the template for every file here.

Changes

File Change
consts.py MALICIOUS_PACKAGE_POLICY_ID
cli_types.py ScaScanTypeOption.MALICIOUS_PACKAGES
scan_command.py malicious-packages added to the --sca-scan default set
scan_parameters.py malicious_packages wire parameter
sca_policy_details.py Advisory + Remediation rows (remediation from the policy's remediation_guidelines), registered in _DETAILS_BY_POLICY
sca_table_printer.py Advisory column, Malicious Packages title
README.md option docs

text_printer and rich_printer both consume _DETAILS_BY_POLICY, so they need no changes.

Why the scan option is required

ScaScanDetectorBase.ShouldRunDetector runs a detector only when no [ScaScanDetector] option is mentioned, or when that detector's own option is explicitly true. The CLI always sends package_vulnerabilities / license_compliance / maintainability, so the "no opinion" path is already closed — without malicious_packages the detector never runs. The , False) default when the option is deselected is deliberate for the same reason.

Deliberate omission: no GHSA row

The ticket asks for a "GHSA- ID (if present)". That data does not exist: threat-service's packages/batch projects only the cluster's primary id (MAL- → CVE- → GHSA-), so there is exactly one threat_id to render. A GHSA row would always be empty.

Verification

Verified end to end against a live backend — cycode scan -t sca --sca-scan malicious-packages on a fixture containing flatmap-stream@0.1.1:

Package flatmap-stream was identified as malicious.    Violation 1 of 1
  Severity     ❗ CRITICAL
  Advisory     MAL-2025-20690
  Remediation  This package has been identified as malicious. Remove it from your dependencies.

102 unit tests pass (tests/cli/printers, tests/cli/commands/scan).

🤖 Generated with Claude Code

@AradTraub
AradTraub force-pushed the CM-72593-malicious-package-cli-output branch 2 times, most recently from aede77e to c34997c Compare November 1, 2026 09:06

@omer-roth omer-roth 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 for DRY / KISS / YAGNI. Scope and approach look good; comments below are about duplication and test overlap, none blocking except the remediation one, which also resolves the "Known nit" in the description.

Comment thread tests/cli/printers/test_text_printer.py Resolved
@omer-roth

Copy link
Copy Markdown
Collaborator

@AradTraub thanks, the follow-up commit covers the review. I resolved the threads. Can you rebase on main once more? It's 1 commit behind (#576, gitpython bump). Then CI should go green and this is ready to approve.

AradTraub and others added 3 commits November 1, 2026 12:01
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ests

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@AradTraub
AradTraub force-pushed the CM-72593-malicious-package-cli-output branch from 0c76a81 to 82f6eaa Compare November 1, 2026 10:01
@omer-roth
omer-roth merged commit b5066a0 into cycodehq:main Nov 1, 2026
23 checks passed
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.

2 participants