remove distribution from hold, add vulnerability scanning in appview.

1. Removing distribution/distribution from the Hold Service (biggest change)
  The hold service previously used distribution's StorageDriver interface for all blob operations. This replaces it with direct AWS SDK v2 calls through ATCR's own pkg/s3.S3Service:
  - New S3Service methods: Stat(), PutBytes(), Move(), Delete(), WalkBlobs(), ListPrefix() added to pkg/s3/types.go
  - Pull zone fix: Presigned URLs are now generated against the real S3 endpoint, then the host is swapped to the CDN URL post-signing (previously the CDN URL was set as the endpoint, which
  broke SigV4 signatures)
  - All hold subsystems migrated: GC, OCI uploads, XRPC handlers, profile uploads, scan broadcaster, manifest posts — all now use *s3.S3Service instead of storagedriver.StorageDriver
  - Config simplified: Removed configuration.Storage type and buildStorageConfigFromFields(); replaced with a simple S3Params() method
  - Mock expanded: MockS3Client gains an in-memory object store + 5 new methods, replacing duplicate mockStorageDriver implementations in tests (~160 lines deleted from each test file)
2. Vulnerability Scan UI in AppView (new feature)
  Displays scan results from the hold's PDS on the repository page:
  - New lexicon: io/atcr/hold/scan.json with vulnReportBlob field for storing full Grype reports
  - Two new HTMX endpoints: /api/scan-result (badge) and /api/vuln-details (modal with CVE table)
  - New templates: vuln-badge.html (severity count chips) and vuln-details.html (full CVE table with NVD/GHSA links)
  - Repository page: Lazy-loads scan badges per manifest via HTMX
  - Tests: ~590 lines of test coverage for both handlers
3. S3 Diagnostic Tool
  New cmd/s3-test/main.go (418 lines) — tests S3 connectivity with both SDK v1 and v2, including presigned URL generation, pull zone host swapping, and verbose signing debug output.
4. Deployment Tooling
  - New syncServiceUnit() for comparing/updating systemd units on servers
  - Update command now syncs config keys (adds missing keys from template) and service units with daemon-reload
5. DB Migration
  0011_fix_captain_successor_column.yaml — rebuilds hold_captain_records to add the successor column that was missed in a previous migration.
6. Documentation
  - APPVIEW-UI-FUTURE.md rewritten as a status-tracked feature inventory
  - DISTRIBUTION.md renamed to CREDENTIAL_HELPER.md
  - New REMOVING_DISTRIBUTION.md — 480-line analysis of fully removing distribution from the appview side
7. go.mod
  aws-sdk-go v1 moved from indirect to direct (needed by cmd/s3-test).
This commit is contained in:
Evan Jarrett
2026-02-13 15:26:24 -06:00
parent 434a5f1eee
commit de02e1f046
38 changed files with 3134 additions and 962 deletions
@@ -208,6 +208,13 @@
{{ else if not .Reachable }}
<span class="badge badge-sm badge-warning">{{ icon "alert-triangle" "size-3" }} Offline</span>
{{ end }}
{{/* Vulnerability scan badge (lazy-loaded from hold) */}}
{{ if and (not .IsManifestList) .Manifest.HoldEndpoint }}
<span hx-get="/api/scan-result?digest={{ .Manifest.Digest | urlquery }}&holdEndpoint={{ .Manifest.HoldEndpoint | urlquery }}"
hx-trigger="load delay:1s"
hx-swap="outerHTML">
</span>
{{ end }}
</div>
<div class="flex items-center gap-2">
<code class="font-mono text-xs text-base-content/60 truncate max-w-40" title="{{ .Manifest.Digest }}">{{ .Manifest.Digest }}</code>
@@ -283,6 +290,20 @@
</form>
</dialog>
<!-- Vulnerability Details Modal -->
<dialog id="vuln-detail-modal" class="modal">
<div class="modal-box max-w-4xl">
<h3 class="text-lg font-bold">Vulnerability Scan Results</h3>
<div id="vuln-modal-body" class="py-4">
<span class="loading loading-spinner loading-md"></span>
</div>
<div class="modal-action">
<form method="dialog"><button class="btn">Close</button></form>
</div>
</div>
<form method="dialog" class="modal-backdrop"><button>close</button></form>
</dialog>
{{ template "footer" . }}
</body>
</html>
@@ -0,0 +1,24 @@
{{ define "vuln-badge" }}
{{ if .Error }}
{{/* Silently hide on error / no scan record — scan badges are non-critical */}}
{{ else if eq .Total 0 }}
<span class="badge badge-sm badge-success" title="No vulnerabilities found (scanned {{ .ScannedAt }})">{{ icon "shield-check" "size-3" }} Clean</span>
{{ else }}
<button class="flex items-center gap-1 cursor-pointer hover:opacity-80 transition-opacity"
onclick="openVulnDetails('{{ .Digest }}', '{{ .HoldEndpoint }}')"
title="Click for vulnerability details (scanned {{ .ScannedAt }})">
{{ if gt .Critical 0 }}
<span class="badge badge-sm badge-error">C:{{ .Critical }}</span>
{{ end }}
{{ if gt .High 0 }}
<span class="badge badge-sm badge-warning">H:{{ .High }}</span>
{{ end }}
{{ if gt .Medium 0 }}
<span class="badge badge-sm badge-soft badge-warning">M:{{ .Medium }}</span>
{{ end }}
{{ if gt .Low 0 }}
<span class="badge badge-sm badge-info">L:{{ .Low }}</span>
{{ end }}
</button>
{{ end }}
{{ end }}
@@ -0,0 +1,87 @@
{{ define "vuln-details" }}
{{ if .Error }}
{{ if .Summary.Total }}
<!-- Summary available but no detailed report -->
<div class="space-y-4">
<div class="flex flex-wrap gap-2">
{{ if gt .Summary.Critical 0 }}<span class="badge badge-error">{{ .Summary.Critical }} Critical</span>{{ end }}
{{ if gt .Summary.High 0 }}<span class="badge badge-warning">{{ .Summary.High }} High</span>{{ end }}
{{ if gt .Summary.Medium 0 }}<span class="badge badge-soft badge-warning">{{ .Summary.Medium }} Medium</span>{{ end }}
{{ if gt .Summary.Low 0 }}<span class="badge badge-info">{{ .Summary.Low }} Low</span>{{ end }}
</div>
<p class="text-base-content/60 text-sm">{{ .Error }}</p>
{{ if .ScannedAt }}<p class="text-base-content/40 text-xs">Scanned: {{ .ScannedAt }}</p>{{ end }}
</div>
{{ else }}
<p class="text-base-content/60">{{ .Error }}</p>
{{ end }}
{{ else }}
<div class="space-y-4">
<!-- Summary badges -->
<div class="flex flex-wrap items-center gap-2">
<span class="font-semibold text-sm">{{ .Summary.Total }} vulnerabilities found</span>
{{ if gt .Summary.Critical 0 }}<span class="badge badge-error">{{ .Summary.Critical }} Critical</span>{{ end }}
{{ if gt .Summary.High 0 }}<span class="badge badge-warning">{{ .Summary.High }} High</span>{{ end }}
{{ if gt .Summary.Medium 0 }}<span class="badge badge-soft badge-warning">{{ .Summary.Medium }} Medium</span>{{ end }}
{{ if gt .Summary.Low 0 }}<span class="badge badge-info">{{ .Summary.Low }} Low</span>{{ end }}
</div>
{{ if .ScannedAt }}<p class="text-base-content/40 text-xs">Scanned: {{ .ScannedAt }}</p>{{ end }}
{{ if .Matches }}
<!-- CVE table -->
<div class="overflow-x-auto max-h-96">
<table class="table table-sm table-pin-rows">
<thead>
<tr>
<th>CVE</th>
<th>Severity</th>
<th>Package</th>
<th>Installed</th>
<th>Fixed In</th>
</tr>
</thead>
<tbody>
{{ range .Matches }}
<tr>
<td class="font-mono text-xs">
{{ if .CVEURL }}
<a href="{{ .CVEURL }}" target="_blank" rel="noopener noreferrer" class="link link-primary">{{ .CVEID }}</a>
{{ else }}
{{ .CVEID }}
{{ end }}
</td>
<td>
{{ if eq .Severity "Critical" }}
<span class="badge badge-sm badge-error">Critical</span>
{{ else if eq .Severity "High" }}
<span class="badge badge-sm badge-warning">High</span>
{{ else if eq .Severity "Medium" }}
<span class="badge badge-sm badge-soft badge-warning">Medium</span>
{{ else if eq .Severity "Low" }}
<span class="badge badge-sm badge-info">Low</span>
{{ else }}
<span class="badge badge-sm badge-ghost">{{ .Severity }}</span>
{{ end }}
</td>
<td>
<span class="font-mono text-xs">{{ .Package }}</span>
{{ if .Type }}<span class="text-base-content/40 text-xs">({{ .Type }})</span>{{ end }}
</td>
<td class="font-mono text-xs">{{ .Version }}</td>
<td class="font-mono text-xs">
{{ if .FixedIn }}
<span class="text-success">{{ .FixedIn }}</span>
{{ else }}
<span class="text-base-content/40">No fix</span>
{{ end }}
</td>
</tr>
{{ end }}
</tbody>
</table>
</div>
{{ end }}
</div>
{{ end }}
{{ end }}