- auth: panic at init if BACKEND_SECRET missing/short — HS256 would happily
start with an empty key, making admin tokens forgeable by anyone
- websocket: admin check now goes through AuthenticateTokenWithClaims so the
"tv" token-version revocation applies on /ws too; a logged-out or
password-changed token no longer keeps it alive for its full lifetime
- admin diagnostics: check BACKEND_SECRET not the nonexistent AUTH_SECRET
- rowing upload: 10MB cap before buffering + base64 (admin-only route, but
unbounded read = easy memory exhaustion + huge paid Claude call)
- nginx: shared security_headers.conf (XFO/nosniff/Referrer-Policy/HSTS/CSP)
included in every location that sets its own add_header — nginx drops the
parent's whole set otherwise; CSP added to the SPA document;
ssl_protocols pinned to TLSv1.2/1.3; HSTS on apex redirect
- compose: Gitea HTTP bound to 127.0.0.1 (plain HTTP was LAN-exposed);
autoheal docker socket mount read-only
Co-Authored-By: Claude Code <[email protected]>
Two admin-only REST endpoints and a Diagnostics tab in the admin panel:
- GET /admin/config reports which known environment variables are set,
what each is for, and the value only for non-credential vars. Secrets
are never returned, only their presence.
- GET /admin/logs returns the tail of backend/logs/go.log (Gin traffic
plus application lines), bounded to 256 KiB and 500 lines so the read
is constant-size however large the file has grown.
tailLogFile is split out from the handler and tested for the line cap,
the partial-first-line rule, and the empty/missing cases.
Co-Authored-By: Claude Code <[email protected]>
- Backend logs a rate-limited (1/h) "not authenticated" line when a resolver
finds the Spotify client nil instead of silently degrading to null.
- New public-but-gated spotifyNeedsReauth query: false for everyone except
an admin session whose backend has no client.
- The /stp Listening widget offers admins a "Reconnect Spotify" button that
hits /api/spotify/auth and navigates to the returned authorisation URL;
non-admins still see the widget degrade as before.
Co-Authored-By: Claude Code <[email protected]>
Security:
- Token revocation. User gains a TokenVersion counter embedded in both
tokens as a "tv" claim; AuthenticateToken rejects a token whose version
no longer matches the row. Logout bumps it, so logging out now kills
outstanding tokens rather than only clearing cookies. Costs one
primary-key SELECT per authenticated request, which is the price of
having revocation at all.
- Spotify OAuth CSRF. The fixed SPOTIFY_AUTH_STATE constant is replaced by
a per-request one-shot nonce, verified and consumed on callback.
- Private chat attachments. Attachments on private messages are written to
/backend/uploads/private/ and served at /uploads/private/, gated by the
same nginx auth_request admin check used for /hasura/ and /notes/.
Private uploads are rejected from non-admin callers.
- The icecast admin UI (/radio/admin/) is behind the admin gate; listener
traffic is untouched.
- Store caches are mutex-guarded, so -race is clean.
Bugs:
- The email pipeline no longer drops emails permanently on transient
failure. Failures record an attempt counter and are retried up to 3
times; the fetch window rewinds to the oldest retryable email's
ReceivedAt, without which a retry could never re-fetch it.
- Rowing duplicate detection distinguishes ErrRecordNotFound from a real
DB error, so a transient failure no longer causes a duplicate insert
plus a paid Claude call.
- DeletePost propagates its delete error instead of reporting success.
- RecentlyPlayed populates the cache it reads.
- main.go exits non-zero if r.Run fails, so a port conflict is visible.
- Python: the scan truncation flag is set on every deadline path;
timed_out is reported by the worker rather than inferred from the clock;
date validation uses Europe/London rather than server-local time.
- Vue: Time.vue and Radio.vue intervals are cleared on unmount; Feed.vue
guards a missing author; Timer.vue gets an explicit state machine and
compares total elapsed seconds; Elle.vue's comma-operator call and
per-frame console.log are fixed.
Simplification:
- One TTLCache replaces three near-identical cache implementations, with
the differing eviction rules as explicit parameters.
- run_scan's transport index no longer uses one object as both ordering
record and live output; its three phases are separate functions.
- _price_hotels submits all work to a single pool, so the nested-executor
deadlock hazard is gone by construction.
- The NDJSON event generators share one implementation.
- IMAP FETCH responses pair each line with its literal in the type, so
callers no longer hand-skip alternate entries.
- Shared helpers for slice-of-pointers, markdown fences and auth cookies.
- Vue: useHotelSearch, createMirrorStore, useRotation, useCreateForm,
useLinkAttrs, ListWidget and LinkTableItems replace duplicated blocks.
- nginx dev config's duplicated :80/:443 bodies share one partial.
Infra: certbot passes --deploy-hook touching a sentinel that nginx's
watcher reloads on, so renewed certs are served without a restart, and the
watcher also removes the manual restart after first issuance. db is gated
on service_healthy, autoheal is pinned, and the unused envsubst entries
are dropped.
Verified: go build/vet, npx vite build, py_compile, docker compose config
for both overlays, bash -n on all scripts, and an envsubst render of every
nginx template (no leftover placeholders, runtime vars preserved, braces
balanced).
Co-Authored-By: Claude Opus 5 <[email protected]>
Readability pass across all four areas of the stack. Comments explain why
rather than what, concentrated at the points where behaviour is non-obvious:
concurrency, caching, auth, scraping and nginx templating.
Backend: doc comments on every exported declaration across handlers,
services, models and resolvers. Resolver commentary lives inside function
bodies so gqlgen does not strip it on regeneration; schema files use #
comments rather than description blocks so introspection output is
unchanged. Extracted the duplicated auth-cookie blocks into helpers.
Frontend: header comments on every component, store and view, including
STATUS: notes marking which of the parallel/legacy views are still live.
Documented the non-reactive animation-state pattern, the homeData hub and
the WebSocket stale-socket guard. Removed a few dead imports and named the
reconnect-backoff and poll-interval constants.
Python: module and function docstrings covering the Travelodge scraping
contract, the deadline threading, the two-executor concurrency and the
NDJSON streaming protocol.
Infra: header blocks on every compose file, nginx template, Dockerfile and
entrypoint, covering the config selection, envsubst allow-lists, rate-limit
semantics and volume persistence. Hoisted the duplicated envsubst variable
list in nginx/entrypoint.sh.
New: backend/README.md, python/README.md, DEPLOYMENT.md, .env.example,
backend/graph/doc.go. Refreshed vue/README.md. Corrected CLAUDE.md, which
stated a 24h access token where main.go sets 7 days.
No behaviour change. go build/vet, vite build, py_compile and docker
compose config all pass.
Co-Authored-By: Claude Opus 5 <[email protected]>
Admins can flag a chat message as private so only other admin
connections receive it, and can delete any message. Admin status is
read from the auth cookies on the WebSocket upgrade request.
Co-Authored-By: Claude Fable 5.1 <[email protected]>
Background poller fetches emails via IMAP or Microsoft Graph API,
classifies them with Claude Haiku, and creates/updates JobApplication
records automatically. Includes manual sync endpoint and OAuth callback.
Co-Authored-By: Claude Opus 4.6 <[email protected]>
Deleted handle_activity.go, handle_favorites.go, handle_post.go, and
handle_user.go — all logic already exists in schema.resolvers.go.
Removed corresponding REST routes from main.go. Moved UserCredentials
struct (used by Login handler) into handle_auth.go.
Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
When the access token is missing or expired, the handler now falls back
to the refresh token, verifies the user is still admin via DB lookup,
and issues fresh cookies in the subrequest response.
Co-Authored-By: Claude Opus 4.6 <[email protected]>
Add ValidateAdmin endpoint that checks JWT admin claim for use as an
nginx auth_request subrequest. Widen cookie path from backend endpoint
to "/" so the access_token is sent on all paths. Extend access token
lifetime from 24h to 7 days. Disable hasura service by default via
Docker profile.
Co-Authored-By: Claude Opus 4.6 <[email protected]>
Upload, list, and delete fallback music files from the admin page.
Backend handlers validate file type/size and prevent path traversal.
Nginx max body size increased to 50M to support large audio files.
Co-Authored-By: Claude Opus 4.6 <[email protected]>
- Fix auth bypass in UpdatePost/DeletePost (missing return after auth check)
- Remove Spotify access token from callback response
- Replace internal error messages with generic responses in all handlers
- Harden GraphQL: complexity limit, disable playground/introspection in prod
- Add security headers (X-Frame-Options, HSTS, etc.) to nginx
- Disable Hasura console/dev mode in production
- Add DOMPurify sanitization to Markdown component
- Fix cookie removal to use correct domain/path from auth config
- Fix nil dereference in rowing handler when Claude API errors
- Fix wildcard CORS on stamp endpoint
- Pin nginx and certbot Docker image versions
Co-Authored-By: Claude Opus 4.6 <[email protected]>
Generate self-signed certs for local HTTPS, add port 443 and full SSL
server block to dev nginx config, add Spotify redirect URI env var,
improve Spotify token error handling, and fix Chat/Steam mobile sizing.
Co-Authored-By: Claude Opus 4.6 <[email protected]>
Fetches player summary and recently played games from Steam API with
5-minute server-side caching. Displays in the home sidebar with online
indicator and game artwork.
Co-Authored-By: Claude Opus 4.6 <[email protected]>
The CheckOrigin function only accepted the production domain, rejecting
localhost connections in dev. Also removed redundant error response after
a failed upgrade since the upgrader already writes its own HTTP response.
Co-Authored-By: Claude Opus 4.6 <[email protected]>
Replaces direct browser-to-Gitea API calls with a backend service that
proxies and caches the feed (1-min TTL), served via the existing GraphQL
HomeData query. Commit message parsing now happens server-side.
Co-Authored-By: Claude Sonnet 4.6 <[email protected]>