Commit Graph
342 Commits
Author SHA1 Message Date
lukaszraczylo 4d31e535ff test(app): pace broadcast bursts to remove a race flake v0.1.328 2026-11-23 14:31:49 +00:00
lukaszraczylo fe2d9f8b3a fix(metadata): wait for the aggregation worker before closing the store 2026-11-23 14:26:35 +00:00
lukaszraczylo a84f080b79 fix(scanner): rescan packages on remote storage via ScanFile 2026-11-23 14:26:35 +00:00
lukaszraczylo 9b4659218c feat(cache): wire cache.ttl_overrides to metadata freshness 2026-11-23 14:26:29 +00:00
lukaszraczylo 1256756057 fix(api): drop dead per-handler CORS headers 2026-11-23 14:26:17 +00:00
lukaszraczylo 262771d224 fix(api): return 404 when deleting a package that does not exist 2026-11-23 14:26:09 +00:00
lukaszraczylo 536f35ab55 fix(server): stop 431 on /api for browsers with large session cookies v0.1.324 2026-11-23 14:14:28 +00:00
lukaszraczylo 5a9d104b37 chore(lean): model redirects, key lookup, upserts, retries, CORS, TTL v0.1.323 2026-11-23 13:39:03 +00:00
lukaszraczylo f2049383cb fix(api): restrict CORS to allowed origins, refuse cross-origin writes 2026-11-23 13:38:38 +00:00
lukaszraczylo 549d56e0a1 fix(cache): default metadata freshness to 24h, under the age gate 2026-11-23 13:38:37 +00:00
lukaszraczylo 31db940014 fix(scanner): re-read the blob when a scan retry finds its file gone 2026-11-23 13:38:37 +00:00
lukaszraczylo f46e079cee fix(stats): upsert hourly and daily stats on SQLite as PostgreSQL does 2026-11-23 13:38:37 +00:00
lukaszraczylo ae5167ffa9 fix(auth): look up API keys by id, one bcrypt compare per request 2026-11-23 13:38:37 +00:00
lukaszraczylo 787c757827 fix(network): vet every redirect hop against the upstream allowlist 2026-11-23 13:38:36 +00:00
lukaszraczylo ac4f39322c feat(ui): page, search and filter packages on the server
The package list loaded every package, then grouped and paged in the
browser. The dashboard did the same to show ten recent rows.

- PackageList asks the server for one page of 25 groups. The registry
  filter and a debounced search box (300 ms) change the request. A newer
  request replaces the answer of an older one.
- Dashboard loads a page of 10 groups sorted by cached_at, newest first,
  and runs its stats, recent list and chart requests in parallel.
- Stats already used /api/stats only and does not change.
- The store keeps the loading flag on until the last overlapping request
  settles. Deleting a package no longer reloads the full list, and the
  list reloads its own page instead.
- VulnerablePackages keeps the unpaginated call because it filters on
  scan results in the browser.
v0.1.316
2026-11-23 13:26:50 +00:00
lukaszraczylo db5ca2539f perf(api): serve package lists and stats in constant queries
The dashboard waited seconds for /api/packages and /api/stats. Both
handlers ran queries per package, so the cost grew with the cache.

Baseline, measured live through a port-forward (median of 5):
- /api/packages: 3033 ms, 594 items, limit ignored
- /api/packages?limit=50&offset=0: 2813 ms
- /api/stats: 3813 ms
- /api/stats/timeseries?period=1day: 12 ms

Baseline queries per request, counted on SQLite with 20 and 120 rows:
- /api/packages: 141 and 841 queries (7 per package)
- /api/stats: 103 and 603 queries (5 per package)

Both handlers now run a constant number of queries: 4 for the full list,
6 for a page, 6 for stats. The query-count tests fail on the old code.

- /api/packages pages (registry, name) groups with page, page_size,
  registry, q, sort and order, and returns total_groups. Without page
  and page_size it returns every package, so old clients keep working.
- A batched scan lookup replaces the per-package GetScanResult and
  CheckVulnerabilities calls. ScanDecisions returns the same verdicts as
  CheckVulnerabilities, proven by a policy and bypass matrix test.
- The silent 1000-row cap is gone from the list and the Go delete.
- /api/stats sums per registry with GROUP BY and judges blocked
  packages in one batch.
- Migration 202611240001 adds scan_results (package_id, scanned_at) on
  SQLite, PostgreSQL and MySQL. The existing (registry_id, name, version)
  index already serves the group lookups.
2026-11-23 13:26:50 +00:00
lukaszraczylo a7b9917696 chore(lean): model cache, keys, scan policy, access, release age and stats
Six Lean 4 + Mathlib modules prove or refute the audited properties and cite the Go files they model. FINDINGS.md records each verdict with its Lean theorem, Go test and fix commit. The axiom audit and the currency check live in lean4/scripts.
v0.1.314
2026-11-23 13:16:52 +00:00
lukaszraczylo 3143de3a3f fix(scanner): scan PyPI artifacts by release version, not file name
PyPI artifacts are cached under their file name, and the scanners received that name as the version. OSV parsed it as a version below every range, so it missed vulnerabilities that affect the real release (for requests 2.19.0, PYSEC-2023-74 and GHSA-j8r2-6x86-q33q) and reported others that do not. Scanners now receive the release version stored on the package row. The saved result stays keyed by the cache version.
2026-11-23 13:15:34 +00:00
lukaszraczylo f0b37ea719 fix(cache): scan npm and PyPI packages named like Go metadata
IsMetadataEntry treated any name ending in .mod or .info as metadata. An npm or PyPI package with such a name skipped the vulnerability scan and was never blocked. The suffix rule now applies to the go registry only.
2026-11-23 13:15:34 +00:00
lukaszraczylo 7192e4ff3e fix(stats): keep downloads that a daily rollup has not counted yet
The time series let a day's rollup replace the hourly rows and events for that day. A download aggregated after the rollup ran vanished from the chart until the next pass. The chart now takes the larger of the two figures.
2026-11-23 13:15:34 +00:00
lukaszraczylo ad4e848e2b fix(stats): roll up every completed day still held hourly
The daily pass rolled up only yesterday, once a day at hour 0. A pass that ran before its last hour was aggregated, or that a restart skipped, left that day short or empty, and the hourly rows were deleted after seven days. Each pass now recomputes the six completed days before today.
2026-11-23 13:15:33 +00:00
lukaszraczylo 990a1d3409 fix(cache): retry once when a purge removes the blob during a hit
Get probed the blob in getOrFetch and opened it again after the singleflight. A purge between the two returned a storage error to the client. Get now resolves the entry a second time, which sees the miss and fetches again.
2026-11-23 13:15:33 +00:00
lukaszraczylo 440279aa50 fix(cache): stop LRU eviction spinning and failing overlapping stores
evict re-listed the same 100 rows forever when every delete failed, and an
overlapping store received a quota error because a flag rejected the second
eviction. Eviction now returns when a pass deletes nothing, and a second
caller waits for the running eviction.
2026-11-23 13:15:33 +00:00
lukaszraczylo 1f31256769 fix(storage): release replaced bytes when a key is overwritten
Put added the new size to the usage counter without subtracting the file it
replaced. Each overwrite inflated usage until restart and could trip the
quota on a cache that was not full.
2026-11-23 13:15:33 +00:00
lukaszraczylo 4713524778 fix(scanner): honour CVE bypasses under block_on_severity LOW
The LOW policy counted every vulnerability, including bypassed ones, so an
active bypass never unblocked a package. It now counts only the remaining
vulnerabilities.
2026-11-23 13:15:33 +00:00
lukaszraczylo 5c9f7e6af3 fix(pypi): bind original_url to the requested file name
The cache key is built from the request path, but the upstream fetch used
the original_url query value. Any file on an allowed host could be stored
under another package's key. The handler now rejects an original_url whose
file name differs from the requested file.
2026-11-23 13:15:32 +00:00
lukaszraczylo 6f604367da fix(websocket): start the event loop and throttle drop warnings
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.
v0.1.304
2026-11-23 12:56:32 +00:00
lukaszraczylo c98720c02e docs: describe cache.idle_ttl and the cleanup run
Document the new idle_ttl key in the example config and the README.
Explain that artifacts never expire by age and that metadata entries
refresh after default_ttl.
v0.1.303
2026-11-23 12:50:01 +00:00
lukaszraczylo 9a44683fbd feat(ui): note the idle eviction window on the stats page
The stats page now reads idle_ttl from the stats API. It shows
"Cached items not requested for 7 days are removed." in an info alert.
The note stays hidden when idle eviction is off.
2026-11-23 12:50:00 +00:00
lukaszraczylo d6edd40d79 feat(cache): evict items idle past cache.idle_ttl
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.
2026-11-23 12:49:47 +00:00
lukaszraczylo 99c885cd88 fix(ui): stack package rows on phones and drop pager edge buttons
At 320px the package name shared a row with the registry badge, size and downloads, so it had about 90px and scoped names broke mid-word. Below sm the name now takes the full width with the meta row underneath. The pager's first and last buttons wrapped onto a second line inside the card; the page list already reaches the first and last pages, so the edge buttons are off.
v0.1.300
2026-11-23 12:29:40 +00:00
lukaszraczylo c022824d2b fix(ui): swap native key prompt for a dialog; add favicon v0.1.298 2026-11-23 03:18:43 +00:00
lukaszraczylo 5420480ef8 fix(metadata): keep created_at on CVE bypass edit; repair MySQL suite 2026-11-23 03:18:42 +00:00
lukaszraczylo bde9eebf3d fix(ui): show the PyPI release version in every version display 2026-11-23 03:18:42 +00:00
github-actions[bot]andGitHub f65c0cc1f3 chore(deps): update dependencies
Automated dependency update. All tests passed.
2026-11-23 03:17:22 +00:00
lukaszraczylo 947b264d94 fix(pypi): send the release version in the scanned package list
The package list builds its own payload when scanning is on, and that payload left out release_version, so the dashboard still showed file names. A helper now builds the summary and a test covers it.
v0.1.294
2026-11-23 02:47:34 +00:00
lukaszraczylo 1c9b04fba4 fix(pypi): key rows on the file name and show the release version
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.
v0.1.293
2026-11-23 02:36:53 +00:00
lukaszraczylo fb25501ae4 test(integration): build the integration suites again
The mysql and postgres suites used a removed cache rebuild method, a map for string metadata, and a shadowed metadata package. The mysql suite now sets parseTime. JSON columns pick json on mysql and jsonb elsewhere, so the mysql schema creates.
2026-11-23 02:36:51 +00:00
lukaszraczylo f0b7139a92 fix(pypi): record the release version and skip metadata sidecars
A PyPI package row held the file name as its version, and each PEP 658
sidecar became its own package. The version now comes from the file name, and
a wheel or zip adds a local-version suffix so distinct files keep distinct
cache keys. The sidecar streams from upstream without a package row. Rows
written before this change age out through the cache TTL.
2026-11-23 02:29:14 +00:00
lukaszraczylo 879ece368e fix(stats): include unaggregated downloads in the timeseries
The timeseries read only the aggregated tables. The hourly worker skips the
current hour and the daily rollup skips the current day, so fresh downloads
showed as zero. The query now merges raw download events, hourly rows and
daily rollups, with all buckets in UTC. The change in gormstore is limited to
GetTimeSeriesStats.
2026-11-23 02:29:14 +00:00
lukaszraczylo 81e3f9c74f fix(frontend): show load failures as errors and add a not-found route
A failed request left the store error set while the view kept its own
empty-list branch, so the page said nothing was cached. Every view now
checks loading, then error, then content, and the retry button refetches.
Unknown paths render a NotFound page with a link to the dashboard. The brand
shares the sidebar left edge, and a stopped socket reads Live updates paused
in a neutral tone; the client already retries with backoff.
2026-11-23 02:29:14 +00:00
lukaszraczylo 24dfb6eace chore(frontend): remove the hand-written ui kit and unused dependencies
The library provides every component, so src/components/ui, the cn helper,
the badge class helpers, tailwind.config.js and components.json go. Drop clsx,
class-variance-authority, tailwind-merge, tailwindcss-animate, lucide,
@vueuse/core, marked, reka-ui, the typography plugin and the Font Awesome
web font.
2026-11-23 02:29:14 +00:00
lukaszraczylo a5fd828410 feat(frontend): rebuild the bypass panel with library forms
Field, Input, Textarea, Checkbox, SegmentedControl and Dialog replace the
hand-written form. The status filter now applies the expired choice, which
the old click handler compared instead of assigning. Results show as toasts
and fetch failures as an ErrorState. Add a strict-mode smoke test per view.
2026-11-23 02:29:14 +00:00
lukaszraczylo 54bc809f66 feat(frontend): rebuild package, detail and vulnerable views
Package groups use Accordion with Table or DataTable in the cards layout
below sm. Delete confirmations use ConfirmDialog and results go to the
Toaster. Vulnerability descriptions render through Markdown instead of
v-html, and references use the library Link.
2026-11-23 02:29:13 +00:00
lukaszraczylo 041c6e8012 feat(frontend): rebuild the dashboard and stats on library components
KpiTile and StatGroup carry the totals, BarChart draws download activity,
ActivityFeed lists live events and DataTable lists recent packages and
registries. Loading, empty and error states use the library states. Severity
badges are StatusBadge with the tones critical danger, high warning, moderate
info and low neutral, and always print the word.
2026-11-23 02:29:13 +00:00
lukaszraczylo 0a0286df41 feat(frontend): add the perfect-design theme, shell and helpers
Install @perfect-design/ui 0.3.10 with the workbench style pack, IBM Plex
faces and the inline theme boot script. The app shell uses AppHeader, AppShell
and SidebarNav. Shared formatters, severity tones and icon data replace the
per-view copies. A test checks that main.css scans only the library
directories the app imports.
2026-11-23 02:29:13 +00:00
lukaszraczylo b88f9d2c99 chore: ignore local worktrees 2026-11-23 02:29:13 +00:00
lukaszraczylo d38eb34e06 fix(postgres): create the stats upsert indexes and partition audit_log
The hourly and daily aggregation upserts name a unique expression index that AutoMigrate does not create, so every aggregation failed on PostgreSQL. AutoMigrate also created audit_log as a plain table, so the partition step failed on every start. The partition manager now creates the two indexes and replaces an empty plain audit_log with a partitioned one.
v0.1.291
2026-11-23 02:23:35 +00:00
lukaszraczylo ea00fac0fe style: fix remaining golangci-lint findings v0.1.290 2026-11-23 01:21:16 +00:00
lukaszraczylo 1fefe03e8f fix(sqlite): stop prepared statements starving the connection pool 2026-11-23 01:21:14 +00:00