Commit Graph
180 Commits
Author SHA1 Message Date
lukaszraczyloandGitHub db5dfef2d5 Update go.mod and go.sum (#123) 2026-08-28 06:49:21 +01:00
lukaszraczyloandGitHub b6a0a0800f Update go.mod and go.sum (#122) 2026-08-27 05:55:12 +01:00
lukaszraczyloandGitHub 36b99d528e Update go.mod and go.sum (#121) v0.1.174 2026-08-26 04:25:36 +01:00
lukaszraczyloandGitHub 601455cb9b Update go.mod and go.sum (#120) v0.1.173 2026-08-22 04:20:58 +01:00
lukaszraczyloandGitHub e0a489e471 Update go.mod and go.sum (#119) v0.1.172 2026-08-21 04:25:00 +01:00
lukaszraczyloandGitHub aa4b79ab0c Update go.mod and go.sum (#118) v0.1.171 2026-08-18 04:21:39 +01:00
lukaszraczyloandGitHub 8db5aa099b Update go.mod and go.sum (#117) v0.1.170 2026-08-15 04:18:04 +01:00
lukaszraczyloandGitHub 47f63e3b06 Update go.mod and go.sum (#116) v0.1.169 2026-08-13 04:51:47 +01:00
lukaszraczyloandGitHub 43f23900e0 Update go.mod and go.sum (#115) v0.1.168 2026-08-12 04:48:48 +01:00
lukaszraczyloandGitHub 3a113557cd Update go.mod and go.sum (#114) v0.1.167 2026-08-11 04:36:08 +01:00
lukaszraczyloandGitHub 22163595fd Update go.mod and go.sum (#113) v0.1.166 2026-08-08 04:35:19 +01:00
lukaszraczyloandGitHub 4dc7e2fcfb Update go.mod and go.sum (#112) v0.1.165 2026-08-07 05:01:46 +01:00
lukaszraczyloandGitHub 557ebc8410 Update go.mod and go.sum (#111) v0.1.164 2026-08-06 05:05:19 +01:00
lukaszraczyloandGitHub 2c82cd8a7a Update go.mod and go.sum (#110) v0.1.163 2026-08-04 06:51:26 +01:00
lukaszraczyloandGitHub 47cc2900a6 Update go.mod and go.sum (#109) v0.1.162 2026-08-01 06:58:29 +01:00
lukaszraczyloandGitHub c6e7c0d4c8 Update go.mod and go.sum (#108) v0.1.161 2026-07-30 06:45:43 +01:00
lukaszraczyloandGitHub c6ad90f742 Update go.mod and go.sum (#107) v0.1.160 2026-07-29 06:56:36 +01:00
lukaszraczyloandGitHub dfc7d0c917 Update go.mod and go.sum (#106) v0.1.159 2026-07-28 06:51:45 +01:00
lukaszraczyloandGitHub 4442cb3062 Update go.mod and go.sum (#105) v0.1.158 2026-07-27 07:33:24 +01:00
lukaszraczyloandGitHub 3ce6d274d5 Update go.mod and go.sum (#104) v0.1.157 2026-07-25 06:48:25 +01:00
lukaszraczyloandGitHub ce7cb769b3 Update go.mod and go.sum (#103) v0.1.156 2026-07-24 06:54:19 +01:00
lukaszraczyloandGitHub f3a210fd8d Update go.mod and go.sum (#102) v0.1.155 2026-07-23 06:59:04 +01:00
lukaszraczyloandGitHub c7f05c426f Update go.mod and go.sum (#101) v0.1.154 2026-07-22 06:55:12 +01:00
lukaszraczyloandGitHub bd3e8f024c Update go.mod and go.sum (#100) v0.1.153 2026-07-21 06:54:11 +01:00
lukaszraczyloandGitHub c390074f1c Update go.mod and go.sum (#99) v0.1.152 2026-07-17 06:46:38 +01:00
lukaszraczyloandGitHub 43d39bb07a Update go.mod and go.sum (#98) v0.1.151 2026-07-14 06:35:56 +01:00
lukaszraczyloandGitHub a95cd85155 Update go.mod and go.sum (#97) v0.1.150 2026-07-13 07:23:08 +01:00
lukaszraczyloandGitHub d48079e859 Update go.mod and go.sum (#96) v0.1.149 2026-07-11 05:05:30 +01:00
lukaszraczylo 12a629c652 fixup! feat: comprehensive audit + Tier 3 wiring (security/correctness/features) v0.1.148 2026-07-10 09:38:46 +01:00
lukaszraczylo e39d6a0f0d feat: comprehensive audit + Tier 3 wiring (security/correctness/features)
Multi-agent audit + fix pass covering bugs, security, dead config wiring,
and missing features. All quality gates green: build/vet/test -race/govulncheck/
golangci-lint. Frontend tests 47/47.

SECURITY & CORRECTNESS

- Scanner pipeline fail-closed: cache.go scan timeout now 503 (was goto servePkg);
  scanner.go all-scanners-fail saves ScanStatusError; CheckVulnerabilities blocks
  on missing/error result instead of allowing.
- Scanner argv corrections: govulncheck source-mode + go.mod discovery;
  npm-audit generates lockfile via npm install --package-lock-only --ignore-scripts;
  pip-audit per-extension dispatch (wheel direct / sdist extract+pyproject).
- GHSA version-range filtering implemented (was always-include); url.QueryEscape
  on package name.
- pypi SSRF closed via host allowlist on original_url; url.QueryEscape on
  rewriteURL output.
- Path traversal: cache temp file uses os.CreateTemp; smb keyToPath sanitized;
  filesystem keyToPath returns error + filepath.Abs prefix-verify.
- Goroutine leaks plugged: cache.cleanupWorker stop channel; auth.ValidationCache
  Stop() with sync.Once; ws.unregister buffered with non-blocking send.
- WebSocket double-close panic fixed via sync.Once Client.closeSend().
- Race conditions: gormstore.registryCache sync.RWMutex (was concurrent map
  panic); auth.LastUsedAt no longer mutated under RLock; analytics strict
  lock-ordering invariant (statsMu before downloadsMu).
- Auth validator fails CLOSED on transport/unknown-status errors (was returning
  true,err 'allow cache fallback').
- Credential cache hash full SHA256 (was 8-byte truncate; eliminates 2^32
  collision risk).
- filesystem.fs.used incremented after successful rename (no quota inflation
  race).
- gormstore aggregation events deleted in same tx as insert (no double-counting).
- gormstore.SavePackage uses Updates(map) so zero-value security flags
  (RequiresAuth=false) can be cleared.
- partition_manager validates partition name regex before DROP TABLE.
- vcs/git: version regex validation rejects --option-injection; checkout uses
  --detach -- separator; removed TrimPrefix(repo,'v') that corrupted vault/
  vitess/vim-go.
- WebSocket CheckOrigin allowlist (was return true; CSWSH closed); same-origin
  default + ServerConfig.AllowedOrigins.
- fiber CVE GO-2026-4543 patched (v2.52.10 -> v2.52.12).

FUNCTIONAL FEATURES

- API key DB persistence: APIKeyModel + migration 202604280002, full CRUD,
  async LastUsedAt updates with WaitGroup-tracked goroutines drained on Close.
- Admin bootstrap via GOHOARDER_BOOTSTRAP_ADMIN_KEY env var; idempotent
  (skipped when non-revoked admin already exists).
- Auth middleware factory in pkg/app: RequireAuth, RequireRole, RequirePermission,
  OptionalAuth. Mounted on proxy + read APIs when Auth.Enabled=true.
  DELETE /api/packages/* requires admin role. /health public for k8s probes.
- NFS storage backend: pkg/storage/nfs wraps filesystem with /proc/mounts
  detection (Linux), post-write fsync, read-after-write health probe.
- WebSocket real-time pipeline: pkg/events Broadcaster interface; cache + scanner
  managers emit EventPackageCached / EventPackageDownloaded / EventScanComplete;
  app.go runs 30s EventStatsUpdate ticker. Frontend has full WS client (reconnect
  with exponential backoff 1s->30s, 25s heartbeat, subscriber pattern), Pinia
  realtime store, Dashboard live indicator + activity feed + reactive stats
  override.
- TLS termination: fiber.ListenTLS when Server.TLS.Enabled.
- Pre-warming: Prewarming.Enabled flag wired (was hardcoded false); Interval,
  MaxConcurrent, TopPackages plumbed.
- NetworkConfig wired (timeouts, retry, rate-limit, circuit-breaker).
- AuthConfig.BcryptCost wired.
- Security.Scanners.Static.MaxPackageSize plumbed to cache.io.LimitReader.
- Handlers.{Go,NPM,PyPI}.Enabled gates route mounting.
- Graceful shutdown: authManager.Close drains async writes.

LINT/HYGIENE

- 80 golangci-lint issues resolved: errcheck (Close/Write/RemoveAll wrapped),
  gofmt, gosec G104/G306, govet shadow renames + fieldalignment reorders,
  staticcheck ST1000 pkg comments + QF1003 tagged switches + QF1008 embedded
  field selectors + QF1001 De Morgan's law.

BEHAVIOR CHANGES

- Scanner now fail-closed: deployments without scanner binaries
  (trivy/govulncheck/npm-audit/pip-audit/grype) BLOCK packages instead of
  serving unscanned. Add binaries or plan a future allow-on-scan-error flag.
- WS origin defaults to same-origin; cross-origin dashboards must set
  server.allowed_origins.
- Validator no longer fails open; private packages won't serve from cache when
  validation can't be performed.
- download_events retention dropped from 24h to ~5min (deleted in agg tx).
  Migration 202604280001 purges pre-upgrade events.
- DELETE /api/packages/* requires admin role when auth enabled.

NEW PACKAGES

- pkg/events  - Broadcaster interface
- pkg/storage/nfs  - NFS-aware filesystem wrapper

DEFERRED (out of scope this pass)

- Static scanner implementation (config defines AllowedLicenses/MaxPackageSize/
  BlockSuspicious but pkg/scanner/static/ does not exist).
- AuthConfig.AuditLog wiring (no audit log infra yet).
- CacheConfig.TTLOverrides passthrough (would touch cache.Config beyond
  integrator scope).
2026-07-10 09:37:55 +01:00
lukaszraczylo 3c8b3eb46c fixup! fix: exclude Go module metadata files from package count stats 2026-07-10 09:35:45 +01:00
lukaszraczylo c8bc8eca8f fix: exclude Go module metadata files from package count stats
The dashboard was showing 335 packages while the packages page showed 141
because GetStats was counting .mod and .info files as separate packages.

Changes:
- Filter out .mod and .info files in GetStats query
- Now only counts actual packages (.zip files)
- Dashboard and packages page counts will match

This fixes the discrepancy where:
- Dashboard (/api/stats): was 335, now will be ~141
- Packages page (/api/packages): already 141 (deduplicated)

Resolves: "Dashboard showing 335 packages but /packages showing 141"
2026-07-10 09:35:45 +01:00
lukaszraczylo d5979a8b88 fix: skip scanning Go module metadata files (.mod, .info)
Go module metadata files (.mod and .info) are not actual packages
and should not be scanned for vulnerabilities. Only .zip files
contain the actual module code.

Changes:
- Added .mod and .info suffix checks to isMetadataEntry filter
- These files are now excluded from database storage
- Scanner won't attempt to scan them during rescan cycles

This fixes OSV scanner 404 errors for metadata files like:
- github.com/mattn/go-isatty/@v/v0.0.20.mod
- github.com/clipperhouse/stringish/@v/v0.1.1.info

Resolves: OSV API errors "The current request is not defined by this API"
for Go module metadata files
2026-07-10 09:35:45 +01:00
lukaszraczyloandGitHub c38d6bec0d Update go.mod and go.sum (#95) v0.1.147 2026-07-09 05:23:50 +01:00
lukaszraczyloandGitHub 1616a7d42d Update go.mod and go.sum (#94) v0.1.146 2026-07-07 05:25:04 +01:00
lukaszraczyloandGitHub ec21194229 Update go.mod and go.sum (#93) v0.1.145 2026-07-05 05:27:13 +01:00
lukaszraczyloandGitHub 8967d313e0 Update go.mod and go.sum (#92) v0.1.144 2026-07-02 05:30:08 +01:00
lukaszraczyloandGitHub 75eda36638 Update go.mod and go.sum (#91) v0.1.143 2026-07-01 05:38:54 +01:00
lukaszraczyloandGitHub 2a3666ae7c Update go.mod and go.sum (#90) v0.1.142 2026-06-30 05:31:08 +01:00
lukaszraczyloandGitHub ab45e2f511 Update go.mod and go.sum (#89) v0.1.141 2026-06-28 05:37:58 +01:00
lukaszraczyloandGitHub 6b8f8443fb Update go.mod and go.sum (#88) v0.1.140 2026-06-27 05:27:45 +01:00
lukaszraczyloandGitHub e451ec5f1f Update go.mod and go.sum (#87) v0.1.139 2026-06-26 05:32:55 +01:00
lukaszraczyloandGitHub 3898756bf6 Update go.mod and go.sum (#86) v0.1.138 2026-06-24 05:31:06 +01:00
lukaszraczyloandGitHub 3c22e53c2e Update go.mod and go.sum (#85) v0.1.137 2026-06-23 05:30:05 +01:00
lukaszraczyloandGitHub 12a75bf77d Update go.mod and go.sum (#84) v0.1.136 2026-06-22 05:38:46 +01:00
lukaszraczyloandGitHub 1211320939 Update go.mod and go.sum (#83) v0.1.135 2026-06-19 05:39:39 +01:00
lukaszraczyloandGitHub 86f7d974e7 Update go.mod and go.sum (#82) v0.1.134 2026-06-18 05:36:29 +01:00
lukaszraczyloandGitHub f0eaf695ab Update go.mod and go.sum (#81) v0.1.133 2026-06-17 05:37:06 +01:00
lukaszraczyloandGitHub cfceb063ee Update go.mod and go.sum (#80) v0.1.132 2026-06-11 05:36:25 +01:00
lukaszraczyloandGitHub 76b38c5c10 Update go.mod and go.sum (#79) v0.1.131 2026-06-09 05:30:46 +01:00