Skip to content

Add security scanner#168

Closed
aarnaud wants to merge 1 commit into
git-pkgs:mainfrom
aarnaud:feat/artifact-scanner-hook
Closed

Add security scanner#168
aarnaud wants to merge 1 commit into
git-pkgs:mainfrom
aarnaud:feat/artifact-scanner-hook

Conversation

@aarnaud

@aarnaud aarnaud commented Jun 12, 2026

Copy link
Copy Markdown

No description provided.

@aarnaud aarnaud force-pushed the feat/artifact-scanner-hook branch from ff441f4 to 54b56f0 Compare June 12, 2026 16:02
Runs a scanner pipeline on every successful first-time ingest
(cache hits skip it). Decisions allow, warn, or block based on
configurable severity thresholds; blocked artifacts are removed
from storage and the request returns 451 Unavailable For Legal
Reasons with X-Scanner-Severity and a JSON body listing findings.

The OSV reference scanner reuses the existing enrichment service.
Future byte-level scanners (Trivy, ClamAV) can plug in without
touching handler call sites - Request.OpenContent exposes the
stored bytes from day one.

Off by default (scanners.enabled: false). Per-content-hash results
are persisted to artifact_findings/artifact_scans (schema bump
1 -> 2, migration 006) so mirror runs and repeat ingests dedupe
naturally.

UI surfacing:
- Per-artifact findings inline under each artifact row on the
  version detail page, with the same severity-color treatment as
  the OSV vulnerability panel. One bulk query (GROUP BY artifact_id
  in Go) avoids N+1 reads per render.
- Deduped findings rolled into the top "Security Vulnerabilities"
  panel so it appears whenever scanner findings exist, not only
  when the OSV vuln cache has matching rows. Aggregation keeps the
  highest severity per (scanner, finding_id) and sorts
  critical->unknown.
- Unconditional Ecosystem, Version, and Artifacts rows on the
  Version Info panel so it never renders empty when license /
  published date / integrity are all missing.
- Severity-colored badge on each row of the package version list
  showing the scanner finding count. One LIKE query over
  version_purl avoids N+1 reads across the version list.

Dashboard stats now count only packages / versions with at least
one cached artifact (storage_path IS NOT NULL) so the headline
numbers stay consistent with the recent / popular / packages-list
queries when scanner blocks or aborted fetches leave package or
version rows behind without an artifact.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@aarnaud aarnaud force-pushed the feat/artifact-scanner-hook branch from 54b56f0 to 167c8ee Compare June 12, 2026 17:03
@aarnaud aarnaud closed this Jun 12, 2026
@aarnaud aarnaud deleted the feat/artifact-scanner-hook branch June 12, 2026 18:03
@aarnaud aarnaud restored the feat/artifact-scanner-hook branch June 12, 2026 18:05
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