fix(web-ui): dead nav branch removal, prod CSP eval drop, fail-closed auth guard (#783)#891
Conversation
…auth guard closed (#783) - AppSidebar: delete the unreachable !enabled 'coming soon' branch (all NAV_ITEMS were enabled:true) - security-headers: ship 'unsafe-eval' only in dev (Next.js React Refresh); document the residual localStorage-JWT + unsafe-inline risk and upgrade path - AppLayout: probe-error path now fails closed to /login instead of rendering the shell; checkAuthAccess docs updated Closes #783
…, exfil comment accuracy (#783)
|
Claude finished @frankbria's task in 3m 18s —— View job I'll analyze this and get back to you. |
… a dead port hangs (#783)
|
Claude finished @frankbria's task in 11m 17s —— View job Precision bug-hunt review completeReviewed PR #891 for concrete defects only (logic errors, null-deref/crash paths, security vulnerabilities, data loss, race conditions, breaking contract changes). Style/architecture/coverage are owned by the separate general review and excluded.
Result: ✅ no defects found. Summary posted as a separate comment. All four runtime hunks verified correct against their real callers: the CSP dev/prod split is wired through |
|
✅ GLM review: no defects found. Scope: precision bug-hunt (logic errors, null/crash paths, security vulns, data loss/races, breaking contract changes). Style/architecture/coverage are covered by the separate general review and excluded here. Verified against real callers/callees:
|
Demo verification (Phase 11 — hard gate) ✅Production build (
Demo artifacts (session-local, gitignored): Demo-discovered fix: on networks where a dead backend port hangs instead of refusing (observed on WSL2), the probe had no timeout, so the fail-closed redirect waited on the OS connect timeout (~2 min on the loader). Added |
Closes #783
Summary
Three frontend residuals from the SaaS launch-readiness audit (P3.12):
NAV_ITEMSentry wasenabled: true, so the disabled "coming soon"<span>branch inAppSidebarwas unreachable. Theenabledfield and branch are deleted.'unsafe-eval'now ships only in dev (NODE_ENV === 'development'; Next.js React Refresh needs it, production bundles never eval).'unsafe-inline'stays (App Router without nonce middleware requires it) and the residual risk is documented accurately insecurity-headers.js, including the top-level-navigation exfil channel CSP cannot close (window.location = attacker + token) and the upgrade path (nonce middleware / httpOnly-cookie token) — the path the issue's acceptance criteria explicitly allow.checkAuthAccess()probe error (backend unreachable) now redirects to/logininstead of rendering the app shell. Only an explicit 2xx allows token-less access (auth-disabled backend). Server-side enforcement was never affected; this was cosmetic fail-open.Review
Cross-family adversarial review (opencode / GLM) run pre-PR: 0 critical/major, 4 minor — 2 fixed in-branch (exfil-comment accuracy, stale nav test wording + undercount), 2 handled below (limitations / demo verification).
Known limitations
CODEFRAME_AUTH_REQUIRED=falseand no token, a transient backend outage now lands the user on/login(previously the shell rendered and SWR auto-recovered). Recovery: navigate back to/once the backend is up. This is the tradeoff the issue's acceptance criteria requested ("prefer failing closed to /login on the probe-error path").unsafe-inline+ localStorage JWT residual risk remains (documented, not eliminated) — full fix is nonce middleware and/or httpOnly cookie migration, out of scope per acceptance criteria.Test plan
web-ui npm test— 1070/1070 pass (new: prod-CSP-has-no-eval, dev-CSP-has-eval, fail-closed probe-error redirect)npm run lint— cleannpm run build— succeeds