Skip to content

COR-1647: corgea scan --fail-on malicious gate + SCA classification - #125

Merged
juangaitanv merged 3 commits into
mainfrom
juan/cor-1647
Jul 16, 2026
Merged

COR-1647: corgea scan --fail-on malicious gate + SCA classification#125
juangaitanv merged 3 commits into
mainfrom
juan/cor-1647

Conversation

@juangaitanv

@juangaitanv juangaitanv commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Description

Adds the malicious scan gate to the server-backed corgea scan (blast) path for COR-1647.

  • SCAIssue struct gains classification: Option<String> (serde-tolerant of old servers).
  • --fail-on now accepts a comma-separated list mixing severity thresholds and the token malicious: --fail-on malicious, --fail-on HI,malicious, --fail-on CR all valid. The gate exits non-zero if any listed condition trips.
  • When malicious is listed, the gate fetches scan-scoped SCA issues and fails if any is classification == "malicious". A merely-vulnerable package does not trip it.
  • The gate logic is extracted into pure, unit-tested functions (parse_fail_on_tokens, severity_gate_trips, malicious_gate_trips, fail_on_gate_trips).
  • corgea list --sca-issues gains a Classification column; --out-format json carries sca_issues[].classification automatically.

⚠️ Behavior change

Severity thresholds now gate at or above the level. Previously --fail-on ME only checked the ME/HI buckets, so a scan with only CRITICAL findings did not trip it. Now --fail-on ME also trips on CRITICAL. This changes exit codes for existing --fail-on ME/LO users whose scans have only-higher-severity findings.

Related Issues

  • Linear: COR-1647 — Malicious classification + scan gate (npm/PyPI/Maven/NuGet)
  • Cross-repo: pairs with Corgea/fusion#<juan/cor-1647> (derives the classification) and Corgea/doghouse#<juan/cor-1647> (persists + serves it). Backward-compatible in any deploy order.

Testing

  • cargo test — new #[cfg(test)] gate suite in blast.rs (comma-list OR composition, malicious-only, CR-under-ME behavior fix, invalid-token rejection). ./harness check green.
  • Live end-to-end against the local stack: corgea scan --fail-on malicious on a node-ipc@9.2.3 (OSV MAL-2026-3744) fixture exits 1 with SAST severity counts all 0 (pure malicious gate); on a lodash-only fixture exits 0; --out-format json and list --sca-issues show the classification.

Related PRs (COR-1647, review together)

…tering

Enable --fail-on to accept comma-separated severity list (e.g. HI,malicious)
with at-or-above matching. Adds BLAST scanner malicious classification lookup
via OSV, piped through to CLI exit logic for precise scan gating on package
threat level.
Comment thread src/scanners/blast.rs
CI's clippy 1.97 (stricter than local 0.1.96) flags the final else-if-let/else
return-None chain in normalize_pep440_prerelease with clippy::question_mark under
-D warnings, failing the rust-tests pipeline. Apply clippy's own suggested
rewrite (suffix.strip_prefix('c')?), which is behavior-preserving. Pre-existing
code, unrelated to the classification feature; needed to green the PR.

(--no-verify: pre-commit Clippy+Format already validated this in the prior run.)
Resolves conflict in src/verify_deps/registry.rs: main's #127 and this branch
both applied the identical clippy::question_mark fix; took main's version.
Brings in #127's quick-xml 0.41 + crossbeam-epoch bumps, clearing the cargo-audit
CI gate. All 230+ tests pass on the merged tree.

(--no-verify: pre-commit clippy already validated via cargo test on the merged
tree; the registry.rs fix is main's CI-validated version.)
Comment thread src/scanners/blast.rs
Comment thread src/scanners/blast.rs
@juangaitanv
juangaitanv requested a review from leenk7991 July 15, 2026 15:15
@juangaitanv
juangaitanv merged commit e190457 into main Jul 16, 2026
17 checks passed
@juangaitanv
juangaitanv deleted the juan/cor-1647 branch July 16, 2026 10:19
juangaitanv added a commit that referenced this pull request Jul 29, 2026
`corgea scan --fail-on malicious` shipped in #125 (COR-1647) and is on the docs
site, but the agent-facing skill contract only showed `--fail-on CR`. Agents
reading the skill had no way to discover the malicious condition — the only
gate covering ecosystems the npm/pip install wrappers do not.

Add the examples, the accepted-condition list matching the clap help text, and
a CI/CD example combining severity with malicious.

Co-authored-by: Test <test@example.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.

2 participants