Skip to content

fix(scans): show hostname/IP on scan detail header, not a raw UUID#613

Merged
remyluslosius merged 1 commit into
mainfrom
fix/scan-detail-host-label
Jun 20, 2026
Merged

fix(scans): show hostname/IP on scan detail header, not a raw UUID#613
remyluslosius merged 1 commit into
mainfrom
fix/scan-detail-host-label

Conversation

@remyluslosius

Copy link
Copy Markdown
Contributor

The Scan detail page (/scans/{id}) Host field rendered
scan.host_id.slice(0, 8) — a truncated UUID (e.g. 019eccd8) that isn't
human-friendly. Per request: show the hostname if present, else the IP
address
(short UUID only as an impossible-case last resort).

Changes

Backend (api-scans v1.1.0 — C-07 / AC-08)

  • GET /scans/{id} resolves the host's hostname + ip_address from the
    hosts table onto ScanSummary, using host(ip_address) for clean
    inet→text and COALESCE for NULLs. A missing host row (FK is
    ON DELETE RESTRICT, so unexpected) leaves the labels empty rather than
    failing the read. The list endpoint (GET /scans) omits them — the caller
    already has host context.

Frontend (frontend-scan-detail v1.1.0 — C-08 / AC-08)

  • The Host field renders scan.hostname || scan.ip_address || scan.host_id.slice(0, 8),
    still wrapped in the /hosts/$hostId Link.

Tests

  • Backend AC-08: GET /scans/{id} returns the hostname + IP for a named
    host; an empty-hostname host yields empty hostname + populated IP.
  • Frontend AC-08: source-inspection of the fallback chain (and that the bare
    host_id.slice render is gone).
  • Full api-scans + scanresult suites green; specter check 111 specs.

Verified live

The detail header now shows owas-tst01 instead of 019eccd8.

Note: one bug caught + fixed mid-implementation — COALESCE(ip_address, '')
500'd because ip_address is Postgres inet (can't COALESCE with text);
switched to host(ip_address), confirmed by the failing→passing AC-08 test.

The Scan detail page Host field rendered scan.host_id.slice(0,8) — a
truncated UUID that's not human-friendly.

Backend (api-scans v1.1.0 C-07/AC-08): GET /scans/{id} now resolves the
host's hostname + ip_address from the hosts table onto ScanSummary (via
host(ip_address) for clean inet->text, COALESCE for NULLs). The list
endpoint omits them (the caller already has host context).

Frontend (frontend-scan-detail v1.1.0 C-08/AC-08): the Host field renders
scan.hostname || scan.ip_address || scan.host_id.slice(0,8) — hostname
first, IP fallback, short UUID only as a last resort — still linking to
/hosts/$hostId.

Verified live: the field now shows 'owas-tst01' instead of '019eccd8'.
@remyluslosius remyluslosius merged commit 156facf into main Jun 20, 2026
13 checks passed
@remyluslosius remyluslosius deleted the fix/scan-detail-host-label branch June 20, 2026 17:28
remyluslosius added a commit that referenced this pull request Jun 20, 2026
- SESSION_LOG.md: 2026-06-20 entry for the /scans/{id} host-label fix
  (hostname->IP->short-UUID), the inet COALESCE gotcha, and tests.
- BACKLOG.md: note the scan-detail host label shipped (#613); mark the
  Host Management chart-icon browser verification done (verified live on
  owas-tst01, no longer a pending P3).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant