Fixed findings from the audit reports (SECURITY, QUALITY, PERFORMANCE):
- P-001 · Unbounded per-session timing maps and no connection cap in the sync hub
- S-001 · Anonymous `PUT /access` switches off login for every guarded route
- S-002 · Malformed cookies crash the Node middleware and fail requests in Java
- S-004 · Anonymous `PUT /sync` writes unvalidated JSON into shared session state
Also includes the pre-existing uncommitted changes in web-ui, README, shared-styles and the .changeset files, as the owner asked.
Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
Every language's AuthGuard client/service used "no URL at construction"
to mean "auth disabled forever" - a live SetBaseUrl/setBaseUrl push from
ProjectConfigurator could only ever retarget an *already-enabled* client,
never turn one on for the first time. That made AUTHGUARD_URL a de-facto
required env var everywhere, even though ProjectConfigurator can push it
live after startup.
- Go: shared/backend/auth's New/NewWithStore now default to a "pending"
Service (still enabled, fails closed until a URL arrives) instead of
disabled when authGuardURL is empty; add an explicit Disabled() option
for the genuine standalone/local-dev opt-out.
- Python/Node/Java: add setBaseUrl/set_base_url to each AuthClient so a
client built with an empty base URL can be retargeted in place once a
URL is pushed, the same as the Go client already supported.
- Python/Node: add a coreconfig module (Info/Store), the framework-agnostic
equivalent of shared/backend/coreconfig (Go), for services in those
languages to receive ProjectConfigurator's core-services push at all.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Extracted from three near-identical bespoke implementations (Heretic,
HordeWorker, InfiniteVideo), each ~800-1000 lines hand-rolling the same
status/setup/login/logout/TOTP/admin-user-CRUD proxy around AuthClient.
build_auth_router(get_client, get_store) returns a ready-to-mount
APIRouter matching shared/backend/auth (Go)'s Service response shapes.
Gated behind an optional `fastapi` extra so the rest of this
framework-agnostic package is unaffected. 18 new tests, including a
regression test for a real bug this had (request models nested inside
build_auth_router silently broke under `from __future__ import
annotations`, misrouting every JSON body as a missing query param).
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Mirrors Go's authclient.WithProjectKey: each client now accepts a
project_key/projectKey and sends it as X-Project-Key on every request,
so AuthGuard can enforce per-user project-access restriction for
consumers written in these languages too.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
shared/backend/auth: adds SchemaOptions.ProjectScoping and Store methods
(SetUserProjects/UserProjects/UserProjectsByUser/IsProjectAllowed,
SetKnownProjects/KnownProjects) backing AuthGuard's new per-user
project-access restriction.
shared/backend/authclient: Client can now identify its calling project to
AuthServer via WithProjectKey (sent as X-Project-Key on every request), so
AuthServer can enforce the restriction above per project.
shared/backend/mediaauth: generalized from a media-family-only package
into the one shared auth-proxy engine every AuthGuard-integrated project
should use. New accepts a projectKey; the login-required/setup-claim
storage it needs is now expressed as a small Store interface
(NewWithStore lets any project's own storage satisfy it, not just the
media family's shared `settings` table, which pgSettingsStore still backs
for existing callers). ManagedUpdateUser/ManagedDeleteUser now resolve
their {id} path param via chi.URLParam OR the stdlib 1.22+ ServeMux's
PathValue, so non-chi consumers work unchanged.
packages/web-ui: UserManagement gains an optional `projects` prop (a
per-account project-access picker), used only by AuthGuard's own admin UI.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Button size variants (sm 2rem, lg 2.875rem), sc-input/sc-select (2.6rem),
and the pagination controls (2.1rem/2.25rem) each rendered at a different
height, so any row mixing them (a select next to a button, a page-size
dropdown next to pagination buttons) was visibly misaligned. Textarea
keeps its own min-height since it's multi-line by design.
The button's top offset was unset, so its absolute-position static
position was recomputed from the flex-wrap layout whenever .sc-nav
wrapped onto its own row on open, causing a visible vertical jump.
Pinning top to the header's mobile padding keeps it stationary.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
The select's value was coerced to a string via String(pageSize) while
the <option> values are numbers. Svelte 5 matches a non-bound <select>
value against each option's stored value with Object.is, so "24"
never matched 24 and the dropdown rendered with no option selected.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
The component's markup used sc-pagination* classes that had no
matching rules anywhere in the shared stylesheet, so it rendered
unstyled in every consumer.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Uses the shared Pagination component instead of rendering every
fetched user in one unpaginated list.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
The About item falls back to an <a> when no onAbout handler is wired.
The :visited fix only covered post-click state; the unvisited a:link
pseudo-class still beat the .sc-profile-menu-item class in specificity,
making the item look lighter/whiter than the button-based items until
clicked once.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Documents the hue-spaced palette used to give every project in the
workspace a unique webui primary color: which colors are claimed by
which project, and which remain reserved for future projects.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
AuthPage's password (and, in setup mode, confirm-password) field no
longer forces a non-empty value client-side -- the server already
enforces the real rules (a correct password to log in, >=8 chars to
register/bootstrap), so this only replaces a native browser validation
popup with the server's own error message.
Also bring UserManagement in line with an AuthGuard-only edit that had
drifted ahead of this source (username/email/password relaxed to "at
least one of username/email, password optional" for admin-created
users) so the next consumer sync doesn't silently revert it.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
The workspace's Central/ and Forks/ parent folders were renamed to
Core/ and Fork/ (singular) - a pure local filesystem reorganization,
git repos don't care about their own absolute path. Updates
sync-consumers.ps1's consumer list and workspace-root detection, plus
doc-comment/README cross-references that hardcoded the old paths.
HordeWorker's entry stays at the old 'Forks/HordeWorker' path for now:
a long-running process holds that directory open, so it couldn't be
moved to Fork/HordeWorker in this pass.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Adds a new persisted "wide page" preference (theme/language-style store,
settings-dialog checkbox, main-content width override) alongside the
existing theme switcher and language selector.
Also completes three project renames throughout the shared source:
MediaAnalyzer -> ContentScanner, MediaTools -> CraftStudio, and
LoggingServer -> OmniLogger, across the Go media-backend service enum,
webui AppId/app-config/project-icons, renamed feature components, and
the sync-consumers.ps1 consumer list.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
- Rename MediaConfig -> ProjectConfigurator throughout; drop the Parameters
tab/page; rename the Mounts tab to Projects and restructure it into three
sections: Central services, Main services, Third-party services
- Add a self-describe contract (GET /api/info returning name/tabs/mountTypes)
and a server-side discovery proxy (POST /api/discover-service) so adding a
main service only requires a URL
- Add ProjectConfigurator HA: multiple instances now sync their settings with
each other (GET /api/settings/export, POST /api/settings/sync, a periodic
background puller), last-write-wins per key by updated_at
- Add a generic, project-agnostic file-storage API on CarrierNode
(GET/POST/DELETE /api/mount/{project}/{type}[/*]) driven by the same
configured_mounts data the Projects workspace already writes, usable by any
registered project, not just the media family
- Add last_login_at tracking to the shared auth Store/User (schema, queries,
UpdateLastLogin) and surface it through the shared web-ui ManagedUser type
and UserManagement component
- Retire the "MediaCollection" name: Go module -> repos.gfranz.ch/Gabriel20xx/shared/media-backend,
binary -> mediabackend, session cookie default -> "session", media-webui
merged into webui, media-shared-assets renamed to legacy-assets and pruned
to the one file MediaDesktop still uses
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
User management is now centralized in AuthGuard's webui, so the
per-project Admin dialog (user CRUD + require-login toggle) is
redundant. The require-login toggle will move to ProjectConfigurator
in the future.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Reformat the new scheme-detection test cases with `ruff format` (line
length) so `ruff format --check .` passes in consumers that lint the
whole repo, e.g. Heretic/HordeWorker's CI.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
A bare host:port (e.g. a LAN AuthGuard reachable only over plain HTTP)
was always defaulting to https, so a TLS handshake against a plain-HTTP
AuthGuard failed at the transport level. Now a loopback, RFC1918/RFC4193
private, or link-local host (or a .local name) defaults to http instead;
an explicit http:// or https:// is still always honored as-is.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>