fix(proxy): serve escaped npm scopes and unscanned packages

npm and pnpm request scoped packages as @scope%2fname. Fiber's adaptor
answers 404 to an escaped slash, so a route middleware now rewrites the
scope separator before the adaptor runs.

With scanning off, the cache still waited 30 s for a scan result and then
refused the package. A scanner that is off is now treated as absent.

A scan that fails on infrastructure (timeout, network error, upstream 5xx)
no longer blocks the package until its entry expires. The package is
served and the scan is retried every scan_retry_interval. Set
security.fail_closed to refuse such packages.

The OSV api_url default and the docs named the host, which answers 404 to a
query. They now name https://api.osv.dev/v1/query, and a bare host is
completed with the query path.
This commit is contained in:
2026-11-23 00:31:47 +00:00
parent 65b2f23486
commit a313ac1096
17 changed files with 862 additions and 18 deletions
+5 -1
View File
@@ -103,6 +103,10 @@ security:
block_on_severity: "high" # none, low, medium, high, critical
scan_on_download: true # Scan packages on first download
rescan_interval: "24h" # How often to re-scan packages (e.g., 24h, 168h for weekly)
# When a scan fails on infrastructure (timeout, upstream 5xx) the package is served and the
# scan is retried every scan_retry_interval. Set fail_closed to refuse such packages instead.
fail_closed: false
scan_retry_interval: "5m"
update_db_on_startup: false # Update vulnerability databases on startup
allowed_packages: [] # Packages that bypass security checks (format: "registry/name@version")
ignored_cves: [] # CVE IDs to ignore globally (e.g., "CVE-2021-23337")
@@ -125,7 +129,7 @@ security:
# Supports: npm, PyPI, Go, Maven, NuGet, etc.
osv:
enabled: false
api_url: "https://api.osv.dev"
api_url: "https://api.osv.dev/v1/query" # full query endpoint, not the host
timeout: "30s"
# Grype - Multi-ecosystem vulnerability scanner from Anchore