Skip to content

frontend bug hunt fixes + stream-ticket auth#259

Merged
Polliog merged 12 commits into
developfrom
fix/frontend-bug-hunt
Jun 21, 2026
Merged

frontend bug hunt fixes + stream-ticket auth#259
Polliog merged 12 commits into
developfrom
fix/frontend-bug-hunt

Conversation

@Polliog

@Polliog Polliog commented Jun 21, 2026

Copy link
Copy Markdown
Collaborator

Multi-agent frontend bug hunt followed by fixes. Findings report lives in the gitignored FRONTEND-BUGS.md (48 confirmed, 13 disputed, 40 rejected; no confirmed criticals).

What changed

Bug fixes (60 confirmed/disputed findings across 43 frontend files)

  • API client error handling: guard response.json() in error branches so non-JSON bodies (proxy 502/HTML, empty 204) no longer mask the real HTTP error (auth, admin, exceptions clients).
  • Stale-response races: added local request-sequence guards so an older in-flight load can no longer overwrite fresher results (search, traces, errors, incidents, monitoring, custom-dashboards, alert-preview).
  • Admin client-side authorization: pages that loaded/mutated data without an admin guard now redirect non-admins.
  • Secret exposure: webhook auth secrets are no longer rehydrated into the DOM on channel edit; OIDC callback strips the token from the URL; removed a debug console.log leaking log content and api key metadata.
  • Locale: user-facing dates/numbers use en-US formatting; alert history timestamps no longer mislabel UTC as local.
  • Lifecycle/memory: cleared timers, unsubscribed stores, disposed charts on destroy.
  • Svelte 5 reactivity fixes and assorted UI/validation bugs.

Single-use stream tickets (closes the 3 high "token in URL" findings)

WebSocket/EventSource cannot send an Authorization header, so the session token used to be placed in the stream URL query string (logged by proxies). Now:

  • New migration 049_stream_tickets.sql (ticket stored in the relational DB, not Redis, to stay portable across BullMQ/graphile).
  • POST /api/v1/stream-tickets mints a short-lived, single-use ticket for the authenticated user.
  • The auth plugin (WebSocket + traces SSE) and the SIEM SSE handler accept ?ticket= and consume it once. Legacy ?token= still works for backward compat.
  • Frontend live-tail clients (logs WS, traces SSE, SIEM SSE) mint a ticket and pass it instead of the token.

Global 401 handler

A single fetch interceptor installed at app startup clears auth and redirects to /login (preserving the current path) on any authenticated /api/v1 401 that is not an auth endpoint. Avoids refactoring all 32 API clients.

Tests

  • New stream-tickets.test.ts: 8 tests covering the service (single-use, expiry) and the end-to-end ticket auth chain.
  • Existing WebSocket/SSE/traces/auth suites: 97 tests still green.
  • svelte-check: no new errors (only the pre-existing baseline). Backend tsc --noEmit: clean.

Not done (intentional)

  • Session token in localStorage -> httpOnly cookie: disputed/low finding, left as-is (standard SPA pattern; the cookie move trades XSS token-theft for CSRF surface and a full auth overhaul without a clear net win).

Note: this branch was cut from main, so it also carries a few main-only commits (release 1.0.1, dependency bumps, clickhouse backfill) that are not yet on develop.

@codecov

codecov Bot commented Jun 21, 2026

Copy link
Copy Markdown

@Polliog Polliog merged commit 8249c24 into develop Jun 21, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant