Skip to content

feat(wave4): trust — tests for high-risk paths, relay hardening, credential hygiene - #35

Merged
dPeluChe merged 1 commit into
mainfrom
feat/wave4-trust
Jun 10, 2026
Merged

dPeluChe merged 1 commit into
mainfrom
feat/wave4-trust

Conversation

@dPeluChe

Copy link
Copy Markdown
Owner

Wave 4 — "trust before scale": the final wave of the product audit. No new features; the codebase earns the confidence to grow.

🧪 Tests: 6 → 29 (files 2 → 7)

Module What's covered
api/_relay allowlist (lookalike hosts, http rejected), method rejection, header filtering (cookie/sec-* never forwarded), set-cookie strip, link expose, size cap
sentry/client proxy routing + URL encoding + bearer auth, regional hosts, Link-header cursor parse, fail-fast on 4xx (exactly 1 fetch)
sentry/issues normEnvironment — "all"/empty → no filter
utils/time every band boundary incl. the 360–364d "0y ago" regression
utils/agentPrompt crash-first stacktrace ordering, minimal-data fallbacks

🛡️ Relay hardening (round 2)

  • HTTP method allowlist — GET/POST/PUT/PATCH/DELETE; anything else → 405.
  • 20 MB response cap — checks declared content-length and the actual body, so a hostile upstream can't flood the browser.

🔑 Credential hygiene

  • sentryConfig.update sanitizes the token at the storage boundary (reads already were).
  • Dexie v4 drops the tokens table — it stored the raw token string but had zero readers (saveTokenMeta/getTokenMeta/isTokenExpiringSoon were dead code). SECURITY.md + Settings copy updated.

🧹 Robustness odds & ends

  • gql throws on a 200-with-no-data payload instead of returning undefined as T.
  • fetchWorkflowRunJobs null-safe.
  • New useFlash hook (clears on re-trigger + unmount) replaces the three raw setTimeout "copied/seen" flashes.

Deferred (tracked in TASK_TODO): full schema validation (zod) and hook-level tests (need @testing-library) — longer-term.

npm run check green · docs/TASK_TODO.md ticked — all 4 audit waves complete.

🤖 Generated with Claude Code

…ential hygiene

Wave 4 of the product audit ("trust before scale"):

Tests (6 → 29, files 2 → 7)
- api/_relay: allowlist (lookalike hosts, http), method rejection, header
  filtering (cookie/sec-* dropped), set-cookie strip + link expose, size cap.
- sentry/client: proxy routing + url encoding + bearer auth, regional hosts,
  Link-header cursor parse, fail-fast on 4xx (no retry).
- sentry/issues: normEnvironment ("all"/empty → no filter).
- utils/time: band boundaries incl. the 360-364d "0y ago" regression.
- utils/agentPrompt: crash-first stacktrace ordering, minimal-data fallbacks.
- parseNextCursor/normEnvironment exported for testability.

Hardening & hygiene
- relay: HTTP method allowlist (405 otherwise) + 20MB response cap (declared
  content-length and actual body).
- sentryConfig.update sanitizes the token at the storage boundary.
- Dexie v4 drops the tokens table: it stored the raw token string but had zero
  readers (saveTokenMeta/getTokenMeta/isTokenExpiringSoon were dead code);
  SECURITY.md + Settings copy updated.
- gql throws on a 200-with-no-data payload instead of returning undefined as T;
  fetchWorkflowRunJobs null-safe.
- useFlash hook (clears on re-trigger + unmount) replaces the three raw
  setTimeout "copied/seen" flashes (SinceScope, DetailModalHeader, Checks).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@dPeluChe
dPeluChe merged commit a9e7076 into main Jun 10, 2026
1 check passed
@dPeluChe
dPeluChe deleted the feat/wave4-trust branch June 10, 2026 04:06
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