Skip to content

feat(security): wire CLI package scanner to /v2/packages/assess/local - #1200

Merged
PyRo1121 merged 1 commit into
mainfrom
feat/cli-local-advisory-assess-v2
Dec 1, 2026
Merged

PyRo1121 merged 1 commit into
mainfrom
feat/cli-local-advisory-assess-v2

Conversation

@PyRo1121

@PyRo1121 PyRo1121 commented Dec 1, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Wires OMG CLI's VulnerabilityScanner to the new edge-cached POST https://advisories.latham.cloud/v2/packages/assess/local batch endpoint for all supported OS package ecosystems and language registries (npm, PyPI, crates.io, Go, Debian, Ubuntu, Fedora, Alpine, Red Hat, Rocky Linux, AlmaLinux, SUSE, openSUSE, Wolfi, Chainguard, Linux):

  • Batched local-index assessment (src/core/security/vulnerability.rs):
    • Sends deduplicated { ecosystem, name, version } coordinates in batches of up to 32 per request instead of per-package upstream OSV round trips.
    • Sends Cache-Control: no-cache on AssessmentUse::Admission to bypass Cloudflare's 30s edge cache for fresh revalidation; uses the 30s edge cache + local 5-minute LOCAL_ASSESS_CACHE for AssessmentUse::Review.
    • Validates schema_version == 2, exact result length, and 1-to-1 coordinate correspondence (name + version), failing closed on any mismatch.
  • Deterministic policy_verdict enforcement into AdvisoryRiskReview:
    • reject_malware / reject_exploited (0-day or CISA KEV) → mapped to AdvisorySeverity::Critical with [MALWARE] / [0-DAY] / [KEV] evidence tags, triggering AdvisoryReviewKind::CriticalAdvisory (refuses unattended installs; requires explicit "install-unsafe" interactive consent).
    • warn_vulnerable → surfaces findings with severity, EPSS, and fixed-version evidence (AdvisoryReviewKind::Advisory).
    • warn_partial / status == "partial" → mapped to PackageCoverage::Unknown { reason: EvidenceUnavailable, .. } (AdvisoryReviewKind::CoverageUnknown — never silently treated as safe, never falsely rejected as malware).
    • allow → PackageCoverage::Assessed with no findings.
  • Preserved existing paths:
    • Arch Linux continues using /v1/arch/advisories (with If-None-Match ETag 304).
    • Unsupported ecosystems (e.g. Homebrew) and isolated with_osv_endpoint tests continue using the OSV path cleanly.

Verification

  • Verified in Ubuntu 24.04 WSL (Rust 1.95.0, --no-default-features) with 0 compiler warnings and 54 unit tests passed, 0 failed across core::security::vulnerability, core::security::advisory_review, and core::security::package_review, including 3 new contract tests:
    • core::security::vulnerability::local_assess_tests::local_assess_ecosystem_filter_covers_supported_and_excludes_homebrew
    • core::security::vulnerability::local_assess_tests::local_assess_batches_35_coordinates_and_maps_all_policy_verdicts
    • core::security::vulnerability::local_assess_tests::local_assess_fails_closed_on_mismatched_coordinate

Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

@snyk-io

snyk-io Bot commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

✅ Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
✅ Open Source Security 0 0 0 0 0 issues
✅ Licenses 0 0 0 0 0 issues
✅ Code Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@PyRo1121
PyRo1121 force-pushed the feat/cli-local-advisory-assess-v2 branch 2 times, most recently from 8f1d329 to 3b8ec44 Compare December 1, 2026 17:07
@PyRo1121
PyRo1121 force-pushed the feat/cli-local-advisory-assess-v2 branch from 3b8ec44 to 6ed71a4 Compare December 1, 2026 17:27
@PyRo1121
PyRo1121 merged commit 9f8c19d into main Dec 1, 2026
41 checks passed
@PyRo1121
PyRo1121 deleted the feat/cli-local-advisory-assess-v2 branch December 1, 2026 21:29
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