The server loaded the API key cache before it created the admin key
from GOHOARDER_BOOTSTRAP_ADMIN_KEY. The new key was therefore refused
until the next restart. Bootstrap now runs before the cache loads.
The confirmation for a full rescan used a fixed guess of 10 seconds per
artifact. Scans now record their wall time in scan_results. The new
GET /api/admin/rescan/estimate returns the artifact count of each scope
and the time at the configured concurrency, from the average of recent
scans. While a rescan runs, the status reports elapsed time and an ETA,
and the panel shows the live rate.
POST /api/admin/rescan queues a background rescan of the cached
artifacts with scope vulnerable or all. It ignores the active window and
the age of the last scan, runs on the server context and uses the rescan
worker concurrency. A second request while a run is active gets 409.
GET /api/admin/rescan/status reports queued, done, failed and running.
The System page gets a Rescan section with progress and a confirmation
for the full rescan.
The fiber adaptor builds the URL, Host, Method and header strings of
the net/http request over the fasthttp request buffer. The next request
on the connection overwrites that buffer. The proxies pass these
strings to background scans, singleflight keys and analytics, which
outlive the request. Each proxy route now receives a copy.
A reload or shared link such as /packages?verdict=held returned 404 because the static handler had no fallback. Page loads for paths outside the API and proxy prefixes now receive index.html.
Add a read-only /api/system endpoint with the effective scan policy,
scanner health, rescan, cache and pre-warming settings. It exposes no
credentials or paths.
The package list now carries a verdict (cleared, held, bypassed or
pending) with the reason and the applied bypass. /api/stats adds
bypassed_packages. The vulnerability detail response adds the decision,
a per-scanner severity breakdown and detected_by on each finding.
The pre-warm worker was never started, and its fetch discarded the
response body, so nothing reached the cache. startWorkers now calls
Start. The worker hands each package to a Fetcher. ProxyFetcher calls
the npm, Go and PyPI handlers in-process, resolves the latest version,
and downloads the artifact. The cache and the scan queue then treat it
like a client request.
Pre-warming stays off unless prewarming.enabled is set. Stop is safe on
a worker that never started, and a second Start does nothing.
With security.rescan_on_access and rescan_interval set, a hit whose scan
result is missing or older than the interval is rescanned before it is
served. Concurrent hits share one scan, and the scan runs under the
manager context so a client disconnect does not abort it. The wait is
bounded by scan_wait_timeout. On a timeout the previous result decides,
or the first-download rule applies when none exists.
security.rescan_active_window skips packages not requested within the
window. security.rescan_concurrency runs a bounded pool of scans per
cycle. The cycle summary reports skips by reason. Both options default
to the previous behaviour.
The cache waited a fixed 30 seconds for a first download's scan, and the app never set the wait. Scanners run one after another, so a deployment with several scanners and fail_closed refused most first downloads. security.scan_wait_timeout now sets the wait; 0 keeps 30 seconds.
The app created the rescan worker when security.rescan_interval was set but never started it; only Shutdown called Stop. A scan lost to a restart therefore left its package unscanned for good, and old results were never refreshed with new CVEs. startWorkers now starts the worker. The ledger records it as GH-24.
The cleanup worker now hard-deletes package rows whose deleted_at is
older than cache.deleted_retention. The default is 30 days. A value of
0 keeps the rows. The purge runs in bounded batches, with at most 100
batches per cleanup pass, and removes child rows with the package.
History tables have no foreign key to packages, and stats_snapshots
holds its own counts, so the purge leaves both untouched. The cleanup
log line now reports purged_deleted and deleted_retention.
The aggregation worker now writes one row per UTC day to
stats_snapshots. The row holds package count, total size, vulnerable
package count, the four severity counts and the blocked count. The
write is an idempotent upsert per day.
A migration backfills package counts from cached_at and deleted_at as
the number of packages alive at the end of each day. Vulnerability
fields backfill from scan_results timestamps and stay empty before the
first scan. GET /api/stats/trend returns daily points for 30day, 90day
or 1year with a constant number of queries.
The Stats page shows a chart of cached and vulnerable packages with a
period selector and severity toggles. The Dashboard shows a compact
version. The Lean model gains theorems for the backfill and upsert.
The app built the websocket server but never called Start, so nothing read the 256-slot broadcast channel. After the first 256 events every event was dropped with a warning, and dashboard clients blocked forever on the unbuffered register channel, leaking a goroutine per connection and never receiving events. Run now starts the loop with the other workers. Dropped events are counted in gohoarder_websocket_events_dropped_total and warned about at most once a minute.
Every cached item got a 7-day expiry at store time. A popular tarball
left the cache seven days after it was cached, however often clients
requested it.
Artifacts now get no age-based expiry. Cleanup removes any item whose
last_accessed is older than cache.idle_ttl (default 168h, 0 disables).
It reads the items in bounded batches of 500 through the indexed
last_accessed column and deletes them through deletePackage. Metadata
entries keep the freshness expiry from default_ttl.
Startup and each cleanup run clear the expiry that earlier versions set
on artifact rows. Cleanup records the idle and ttl eviction reasons and
logs the count and bytes freed. The stats API reports idle_ttl in
seconds. Package deletes are soft deletes and no history table has a
foreign key to packages, so download history stays intact.
A PyPI row keys on the file name so each file of a release keeps its own cache and storage key. A new release_version column holds the real version and the API and dashboard show it. Startup deletes old sidecar rows with their storage and fills the release version on old file rows, keeping their storage keys. Startup also drops an empty download_events_old table. This replaces the local-version suffix.
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.
The automated update changed only go.mod, so the build failed on the old v2 imports. This commit moves the code to the v3 API.
The commit replaces BodyParser with Bind().Body, Static with the static middleware, and ListenTLS with ListenConfig. It also updates the tests for TestConfig.
Fixes#179
- Scanner failures (e.g., GitHub API rate limits) no longer mark server as unhealthy
- Server can still serve cached packages when scanners are unavailable
- Readiness probes will now pass with degraded scanner status
- Prevents unnecessary pod restarts due to external API issues
Fixes: Readiness probes failing with 503 due to GHSA rate limiting
- [x] Implement GORM V2 metadata store with SQLite, PostgreSQL, and MySQL support
- [x] Add database migration system using gormigrate for schema versioning
- [x] Create migration CLI tool with support for migrate, rollback, and status commands
- [x] Add Docker support for migration container (Dockerfile.migrate)
- [x] Implement automatic partition management for PostgreSQL time-series tables
- [x] Add background aggregation worker for download statistics
- [x] Support connection pooling configuration (max_open_conns, max_idle_conns, conn_max_lifetime)
- [x] Add blocking mechanism based on vulnerability thresholds in stats and handlers
- [x] Update Helm charts with migration init containers and multi-database configuration
- [x] Replace deprecated SQLite store with optimized GORM implementation
- [x] Add comprehensive integration tests for MySQL and PostgreSQL
- [x] Update frontend to display blocked packages and storage utilization
- [x] Add goreleaser configuration for migrate binary and container image
- [x] Update configuration examples with database backend options and recommendations