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>
38 KiB
38 KiB
Security Report — shared
- Project: shared
- Path: /workspace/Personal/Web/shared
- Analyzed: 2026-10-16
- Commit:
5216031on main - Working tree: 9 uncommitted change(s):
.changeset/user-management-roles.mdandpackages/web-ui/src/lib/components/UserManagement.sveltedeleted;.changeset/remove-user-management.mduntracked;README.md,MediaPlayerControls.svelte,packages/web-ui/src/lib/index.ts,packages/web-ui/src/lib/styles.css,packages/web-ui/src/lib/types.ts,shared-styles.cssmodified. None of them touches authentication code. - Stack: Go 1.25 (
backend/: session proxy, AuthGuard client, websocket sync hub, media core, CarrierNode client, log shipper, Postgres helpers, goose migrations); Node.js ESM withpg(packages/node-backend); Python 3.10+ with asyncpg, bcrypt and optional FastAPI (packages/python-backend); Java 8 target with Jackson (packages/java-backend); Svelte 5 and TypeScript (packages/web-ui); PostgreSQL; Gitea and GitHub Actions. No Dockerfile is present. - Scope: A shared library that other projects vendor as a snapshot. The AuthGuard identity service itself is not in this repository, so every finding that depends on AuthGuard's cookie attributes, rate limits or role enforcement is marked "needs verification". Read: all first-party code in the four languages (the Go auth package was read in a separate pass), the web-ui library source, workflows, scripts and manifests; git history was searched for credential-shaped content. Excluded:
node_modules,packages/web-ui/distand.svelte-kit(gitignored, not tracked),package-lock.jsonandgo.sum(versions only), test bodies except to look for fixtures. Backend findings come from read-only static review passes, and the highest-severity citations were re-checked in the code. Nothing was built, run, audited or sent to the network. - Updated: 2026-10-19 — Critical and High findings handled in the working tree (not committed).
Summary
| Severity | Count | Fixed | Not reproduced | Open |
|---|---|---|---|---|
| Critical | 1 | 1 | 0 | 0 |
| High | 3 | 2 | 0 | 1 |
| Medium | 13 | 0 | 0 | 13 |
| Low | 5 | 0 | 0 | 5 |
| Info | 0 | 0 | 0 | 0 |
The most serious issue is a Python router route that lets an anonymous caller switch off login for everything guarded by require_session. Beyond it, the common themes are fail-open defaults, a websocket hub with no identity, credential endpoints with no throttling, and weaker-than-intended hashing and second-factor controls. No live secrets were found in the current tree or in git history. Most findings that depend on AuthGuard need confirmation against that service.
Issues
S-001 · Anonymous PUT /access switches off login for every guarded route · Critical · Fixed
- Location:
packages/python-backend/src/shared_backend/authproxy.py:561-569(PUT /accesshas no session or role dependency;GET /accessat:557-559is also open),packages/python-backend/src/shared_backend/authproxy.py:313-320(require_sessionreturns the local superadmin profile once login is not required),packages/python-backend/src/shared_backend/authproxy.py:103-105(_LOCAL_PROFILE),packages/python-backend/tests/test_authproxy.py:116-122(asserts the unauthenticated PUT succeeds) - Description: The public
PUT /accessonly depends on the store, so any anonymous request with{"loginRequired": false}disables authentication. Once the flag is off,require_sessionreturns the superadmin profile for every request. The internal variant atauthproxy.py:570-584correctly requiresX-Internal-Auth; the public one does not. The Go equivalent,backend/auth/proxy.go:781, is documented as manager-only (proxy.go:796). - Impact: Anyone who can reach a service that mounts
build_auth_routercan remove authentication from every route guarded byrequire_session. This is the documented usage (packages/python-backend/README.md:123-133), so exposure is likely in consumers. Consumer wiring was not reviewed. - Recommendation: Require a user-manager session for
PUT /access, and forGETunless the value is intentionally public. Add arequire_admindependency, mirroring the GoRequireAdmin. Change the test attest_authproxy.py:116-122to expect 401 without a session, and confirm no consumer exposes the router without this change. - Status: Fixed 2026-10-19 —
PUT /accessnow depends on a newrequire_admindependency that needs a session whose role can manage users (401 without a session or AuthGuard, 403 for other roles), so an anonymous caller can no longer clear the login flag.GET /accessstays public for the login screen, and the internal route keeps its shared-secret check; the tests now assert 401 and 403 and that an admin session can still toggle. Files:packages/python-backend/src/shared_backend/authproxy.py,packages/python-backend/tests/test_authproxy.py.
S-002 · Malformed cookies crash the Node middleware and fail requests in Java · High · Fixed
- Location:
packages/node-backend/src/authclient.js:214(tokenFromRequestruns before thetryblock),packages/node-backend/src/authclient.js:239(decodeURIComponenton the cookie value),packages/java-backend/src/main/java/com/gabriel20xx/shared/auth/AuthClient.java:718-721(URLDecoder.decodewith only anUnsupportedEncodingExceptioncatch),packages/java-backend/src/main/java/com/gabriel20xx/shared/auth/AuthClient.java:278(extractTokencalled frommiddleware) - Description: In Node, the async middleware calls
tokenFromRequestbefore itstry.decodeURIComponentthrowsURIErroron a malformed escape such as a bare%, so the middleware rejects. Express 4 does not catch async rejections, and Node's default unhandled-rejection mode terminates the process. In Java,URLDecoder.decodethrowsIllegalArgumentExceptionon a malformed escape; the only catch is for a different exception type, so the request fails with an error rather than a 401.URLDecoderalso turns+into a space, which alters valid tokens. - Impact: A single unauthenticated request with a crafted cookie can crash a Node service (the package requires Node 20 or newer,
packages/node-backend/package.jsonengines). Java returns server errors instead of 401 and can mangle tokens containing+. - Recommendation: Move token extraction inside the
tryin Node, and maketokenFromRequestreturn''on decode errors. In Java, catchIllegalArgumentExceptionand percent-decode without treating+as a space. Add tests for malformed cookies in both packages. - Status: Fixed 2026-10-19 — in Node,
middleware()now callstokenFromRequestinside itstry, and a malformed cookie escape yields'', so the request gets a 401 instead of an unhandled rejection. In Java,extractCookieTokenescapes a literal+beforeURLDecoderso it is kept, and a malformed escape returns""instead of throwing. Tests were added in both packages; the Java tests were not compiled or run because no JDK is installed here, so they were checked by reading only. Files:packages/node-backend/src/authclient.js,packages/node-backend/test/authclient.test.js,packages/java-backend/src/main/java/com/gabriel20xx/shared/auth/AuthClient.java,packages/java-backend/src/test/java/com/gabriel20xx/shared/auth/AuthClientTest.java.
S-003 · The websocket sync hub has no identity, and self-asserted client IDs gate remote control · High · Open
- Location:
backend/syncsocket/syncsocket.go:293(ServeWebSocketaccepts any connection),backend/syncsocket/syncsocket.go:109(client ID assigned from the message),backend/syncsocket/syncsocket.go:366-369(control:claimandcontrol:releasecompare the requester against the same self-asserted ID),backend/syncsocket/syncsocket.go:146-150(every peer's ID andremoteControlEnabledis broadcast to all members) - Description: The hub does not authenticate the connection. A client chooses its
clientIdinsync:helloorclient:status, with no uniqueness or ownership check. Peers can see each other's IDs and control state, so a new client can adopt the ID of a peer that has remote control enabled and then claim or release that control. - Impact: Any client that can reach
/wsand join a session can take over playback control or impersonate another device. Exposure depends on whether each consumer gates/wswith authentication (not verifiable here; the package's own example wires it with no middleware). - Recommendation: Bind each connection to a server-issued identity (an authenticated user or a signed session token) at upgrade time. Reject duplicate client IDs within a session. Require authentication on the
/wsroute in every consumer, and show that in the package documentation. - Status: Open 2026-10-19 — not changed in this run.
clientIdis still self-asserted and/wsstill accepts unauthenticated connections. The fix needs a protocol change:ServeWebSocketmust take an identity from the consumer's authenticated/wsroute, and the hub must bindclientIdto it. Rejecting duplicate IDs is a policy decision, not a patch: a legitimate reconnect can be refused until the server notices the old socket is dead, and no consumer client was found under/workspace/Personal/Webto confirm clients never reuse an ID. The connection cap added under P-001 limits flooding only; it does not add identity.
S-004 · Anonymous PUT /sync writes unvalidated JSON into shared session state · High · Fixed
- Location:
backend/mediacore/mediacore.go:88(r.With(c.auth.Optional).Put("/sync", ...)),backend/mediacore/mediacore.go:124-152(putSyncState, which does not check the caller),backend/mediacore/mediacore.go:135(session ID defaults to"default"),backend/mediacore/mediacore.go:138and:146-148(rawmediaIdandplayAtstored),backend/mediacore/mediacore.go:1049(512 KB body cap),backend/syncsocket/syncsocket.go:204-213(1000-session cap, no per-entry size limit) - Description: The route uses
Optional, so anonymous callers reachputSyncState, which never checks who they are. Any caller can overwrite any session's playback state, including the shared"default"session. Values are stored without the type checks that the websocket path applies (syncsocket.go:489-498). This assumesOptionaladmits anonymous requests;backend/authwas not read in this pass (needs verification). - Impact: Anonymous clients can overwrite shared playback state, and can pin substantial memory by filling many sessions with large bodies.
- Recommendation: Require authentication, or a session-scoped token, for
PUT /sync. ValidatemediaIdandplayAttypes the way the websocket path does, and cap the stored size per session. - Status: Fixed 2026-10-19 —
PUT /syncnow sits behindRequire, so anonymous callers get 401 when login is required.mediaIdandplayAtmust be null, a number or a string, and strings are trimmed and capped at 128 bytes, so other shapes are refused with 400 and the stored state holds only scalars. Behaviour change: clients that send anonymousPUT /syncwith login enabled are now refused, and non-scalarmediaIdorplayAtvalues get 400. Any authenticated user can still write any session, including"default", which is the session model rather than part of this finding. Files:backend/mediacore/mediacore.go,backend/mediacore/mediacore_test.go.
S-005 · The Python proxy fails open to superadmin when AuthGuard is not configured, and the login override is per process · Medium
- Location:
packages/python-backend/src/shared_backend/authproxy.py:313-320(require_sessionreturns_LOCAL_PROFILEwhenget_clientreturnsNoneor login is off),packages/python-backend/src/shared_backend/authproxy.py:349and:389(the configuration check runs only inget_meandget_status),packages/python-backend/src/shared_backend/authproxy.py:255and:308-311(process-local override that is never refreshed from the store),packages/python-backend/src/shared_backend/authproxy.py:565-567and:582-583(set the override). The Go handler has the same override pattern (backend/auth/proxy.go:759-811, per review). - Description: A missing or unset AuthGuard URL silently makes every guarded route public with a superadmin identity, because the configuration error is enforced on only two routes. Separately, once a process has seen a login-required change, it keeps its own value and never re-reads the store, so other workers or replicas can disagree.
- Impact: A missing environment variable in production silently removes authentication. A worker can stay unauthenticated after login has been re-enabled elsewhere, until it restarts.
- Recommendation: Make auth-disabled mode an explicit opt-in flag that must be set, and apply the configuration check inside
require_session. Remove the process-local override and read the store on each call, with a short-TTL cache if needed.
S-006 · The documented core-config push guard fails open when the secret is unset, and the pushed AuthGuard URL is not validated · Medium
- Location:
packages/node-backend/README.md:50(documented handler),packages/node-backend/src/coreconfig.js:121(same check, inside a JSDoc example),packages/node-backend/src/coreconfig.js:67(URL normalised, with no scheme or host check),packages/python-backend/README.md:104andpackages/python-backend/src/shared_backend/coreconfig.py:111(same comparison in the Python example),backend/coreconfig/coreconfig.go:182(fails closed on an empty secret but compares with!=; per review),backend/auth/proxy.go:819(r.Header.Get("X-Internal-Auth") != secret) - Description: The documented guard is
req.get('X-Internal-Auth') !== process.env.SECRET(and the Python equivalent). IfSECRETis unset and the header is absent, both sides areundefined, so the check passes. The examples do not reject an empty secret, and every comparison is non-constant-time. The store accepts anyauthGuardUrland forwards it toAuthClient.setBaseUrl, so an accepted push can point session validation at a server the attacker controls. The Python internal route atauthproxy.py:576-581does reject an empty secret, which is the correct pattern. - Impact: A consumer that copies the example gets an authentication bypass through a push that controls the AuthGuard target. The timing difference is small in practice but is avoidable.
- Recommendation: Reject an empty configured secret in every handler. Compare with
crypto.timingSafeEqualorhmac.compare_digest. Validate the scheme and host in the store before accepting a URL. Correct the examples.
S-007 · Go proxy routes that change state accept any Content-Type and Origin · Medium
- Location:
backend/auth/proxy.go:1509(decodeProxyJSONdoes not checkContent-Type,OriginorSec-Fetch-Site), state-changing handlers includingUpdateAccessSettings(proxy.go:781),UpdateMe(proxy.go:664), managed-user create, update and delete (aroundproxy.go:920,:951,:994),TOTPDisable(proxy.go:1239) andLogout(proxy.go:1144) - Description: There is no CSRF protection in the proxy. A cross-site form submission with a
text/plainbody is decoded just like a JSON request, so protection rests entirely on theSameSiteattribute of the session cookie. That attribute is set by AuthGuard and forwarded here.backend/authclient/client.go:324notes that the cookie can be domain-scoped (AUTH_COOKIE_DOMAIN) for cross-project SSO, which makes sibling subdomains same-site. - Impact: If a session cookie is domain-scoped and a sibling application is compromised or hostile, it can forge admin actions against this proxy. Needs verification of AuthGuard's cookie attributes.
- Recommendation: On non-GET routes, require
Content-Type: application/jsonand checkOriginorSec-Fetch-Siteagainst an allowlist, or require a custom header that cross-site forms cannot set. Confirm AuthGuard'sSameSitesetting.
S-008 · Signup and first-run setup are not gated on the login setting, and the oldest user is re-promoted to superadmin on restart · Medium
- Location:
backend/auth/proxy.go:1014(Signupchecks only whether the service is enabled; no login-required check before forwarding),backend/auth/proxy.go:724(AdminNeeded),backend/auth/store.go:92-94(EnsureSchemapromotes the oldest user when no superadmin exists),backend/auth/store.go:237(first account becomes superadmin) - Description: When login is not required,
AdminNeededreports no setup is needed, butSignupdoes not check the setting. On a fresh AuthGuard the first caller to sign up becomes superadmin, and there is no bootstrap secret. Separately, at each schema initialisation, if no superadmin exists, the oldest user is promoted. Deleting or demoting the superadmin and then restarting elevates whoever is oldest, possibly an ordinary user. - Impact: On a service with login disabled and no accounts, an anonymous visitor could register as superadmin of the shared AuthGuard (needs verification of AuthGuard's behaviour). Restarts can silently escalate privileges.
- Recommendation: Reject
Signupwhen login is not required, or require a one-time setup token. Run the promotion only when the table is created, and otherwise require an explicit administrator action.
S-009 · Login and TOTP endpoints have no attempt limiting, and the client's IP address is not forwarded · Medium
- Location:
backend/auth/proxy.go:1093(Login),backend/auth/proxy.go:1210(TOTPVerify),backend/auth/proxy.go:1239(TOTPDisable),backend/authclient/client.go:426-459(outbound headers are bearer token, content type and project key only),packages/python-backend/src/shared_backend/authclient.pyandpackages/node-backend/src/authclient.js(same pattern; per review) - Description: The proxy adds no throttling or lockout to password or six-digit TOTP attempts. The AuthGuard clients do not send the end user's IP address, so any per-IP limit that AuthGuard applies sees the proxy's address for every user.
- Impact: Password and TOTP guessing is limited only by AuthGuard, whose behaviour is not in this repository. A per-IP limit at AuthGuard either does nothing or locks out all users together. Needs verification of AuthGuard's limiter.
- Recommendation: Add a per-identifier and per-client-IP limiter in the proxy. Forward the client IP over a trusted channel using trusted-proxy-aware extraction, and confirm how AuthGuard limits attempts.
S-010 · Self-service profile update changes the password without re-authentication · Medium
- Location:
backend/auth/proxy.go:664-712(UpdateMeacceptspasswordat:700-709and forwards it with only the session cookie) - Description: A new password is validated and forwarded to AuthGuard without asking for the current password or a TOTP code.
- Impact: A stolen or fixated session cookie becomes permanent account takeover, because the attacker can set a new password. Needs verification of whether AuthGuard revokes other sessions on password change.
- Recommendation: Require the current password (and a TOTP code when enabled) for password or email changes, and revoke other sessions when the password changes.
S-011 · TOTP codes can be replayed within their validity window in every runtime · Medium
- Location:
backend/auth/totp.go:56(VerifyTOTPreturns only a bool and does not report the matched step),backend/auth/store.go:70-84(no last-used-step column),packages/node-backend/src/totp.js:26-53,packages/python-backend/src/shared_backend/totp.py:38-66,packages/java-backend/src/main/java/com/gabriel20xx/shared/auth/Totp.java:44-88(per review) - Description: Verification accepts the current and adjacent 30-second steps and records nothing about use. A code that an attacker observes stays valid for about 90 seconds and can be submitted repeatedly within that window.
- Impact: A phished or shoulder-surfed code can be reused.
- Recommendation: Return the matched time step, persist
last_used_stepper user, and reject any step less than or equal to it, updating it atomically.
S-012 · The Java client parses the authentication decision with unanchored regular expressions · Medium
- Location:
packages/java-backend/src/main/java/com/gabriel20xx/shared/auth/AuthClient.java:109-112(patterns forvalid,user_id,username,role), with the parsing invalidate(around lines 829-851, per review) - Description: The values are extracted from the raw response body with
Matcher.find(), which returns the first match anywhere in the text, including inside nested objects. The class already depends on Jackson (packages/java-backend/pom.xml), so a real parser is available. - Impact: A change to AuthGuard's response shape, or a nested field with the same name, could make the client accept a session for the wrong user or role.
- Recommendation: Parse the response with Jackson and read top-level fields only. Add tests with nested and reordered fields.
S-013 · Password hashing is below the intended settings in two runtimes · Medium
- Location:
packages/node-backend/src/auth.js:3and:56(100,000 PBKDF2-SHA256 iterations, with aniterationsoption),packages/node-backend/src/auth.js:61and:69-72(verification always uses the constant, and the storedsalt:hashformat records no parameters),backend/auth/proxy.go:1344and:1417(bcrypt.DefaultCost, which is 10, for platform users) vsbackend/auth/password.go:7(BcryptCost = 12, described as the one policy),backend/auth/proxy.go:1460(accepts up to 1024 runes, but bcrypt uses only the first 72 bytes) - Description: The Node PBKDF2 count is fixed at 100,000 iterations. OWASP's current guidance for PBKDF2-HMAC-SHA256 is 600,000 (confirm against the current cheat sheet). A caller passing a different
iterationsvalue produces hashes that can never verify, and because the format stores no parameters the cost cannot be raised without a migration. Go's platform-user path hashes at cost 10 rather than the package's stated cost of 12. Bcrypt ignores bytes beyond 72, so long passwords are silently truncated, which the current validation does not prevent. - Impact: Stored hashes are cheaper to crack than the package intends, and the cost cannot be upgraded.
- Recommendation: Store the algorithm and parameters with each hash and rehash on login. Raise the PBKDF2 count, or move to scrypt or argon2id. Call
HashPasswordeverywhere in Go, and reject or pre-hash passwords longer than 72 bytes with a clear message.
S-014 · Websocket origin verification is disabled when the allowed origin is * · Medium
- Location:
backend/syncsocket/syncsocket.go:267-270(websocketAcceptOptionssetsInsecureSkipVerify = truewhenallowedOrigin == "*") - Description: In
coder/websocket, that option disables the Origin check. It is not TLS verification, despite the name. With the wildcard setting, any web page can open a sync socket from a visitor's browser, which combines with S-003 to let cross-site pages act as peers. - Impact: A page on any origin can connect to a LAN-hosted sync hub, read session state and send control messages if identity is not enforced.
- Recommendation: Remove the wildcard escape hatch, or require an explicit origin list. Never map
"*"toInsecureSkipVerify.
S-015 · Peer IP addresses and user agents are broadcast to all session members, and X-Forwarded-For is trusted unconditionally · Medium
- Location:
backend/syncsocket/syncsocket.go:301(firstX-Forwarded-Forvalue used with no trusted-proxy check),backend/syncsocket/syncsocket.go:146-150(IP address and user agent sent to every peer in the session) - Description: The client's address is taken from the first
X-Forwarded-Forvalue whenever that header is present, and it is shared with every session member along with the user agent. - Impact: Any session member can see the addresses and user agents of other members, and a client can spoof the address that others see.
- Recommendation: Honour
X-Forwarded-Foronly from configured trusted proxies, and remove IP address and user agent from broadcast payloads.
S-016 · Store primitives allow identity confusion and silently disable TOTP · Medium
- Location:
backend/auth/store.go:261(WHERE username = $1 OR lower(email) = lower($1), with no ordering),backend/auth/store.go:72(username is unique only case-sensitively),backend/auth/store.go:184(SetTOTPSecretsetstotp_enabled = false),backend/auth/store.go:277-285(UpdateCredentialswrites whateverpasswordHashit receives, per review) - Description: The identifier lookup matches a username against any account's email, so a username can equal another account's email and make the match ambiguous. Usernames are unique only case-sensitively, so
Adminandadmincan both exist.SetTOTPSecretsilently disables an enabled second factor if it is called. Credential updates accept an empty hash. - Impact: Ambiguous logins that can route a sign-in to the wrong account, and silent second-factor removal if a caller makes a mistake.
- Recommendation: Add a unique index on
lower(username). Reject usernames containing@. Look up usernames and emails separately with a deterministic order. RefuseSetTOTPSecretwhile TOTP is enabled, and reject empty password hashes.
S-017 · Stored paths and caller-supplied names are concatenated into CarrierNode URLs without escaping or validation · Medium
- Location:
backend/mediacore/mediacore.go:187and:224("/media/" + urlPath(record.FilePath)from the database),backend/mediacore/mediacore.go:992-997(urlPathstrips only leading slashes and amedia/prefix),backend/carriernodeclient/carriernodeclient.go:144(path concatenated without escaping),backend/carriernodeclient/carriernodeclient.go:673-719(PushThumbnail,DeleteThumbnail,PushOutput,PushInput,PushCopyuseurl.PathEscapeonly, which leaves.and..unchanged),backend/carriernodeclient/carriernodeclient.go:453-458(a strictthumbnailFilecheck exists for thumbnails only),backend/carriernodeclient/carriernodeclient.go:228-246(MountPathescapes segments and rejects..correctly) - Description: A stored
file_pathcontaining?,#or..is parsed by CarrierNode as a query, a fragment, or a traversal.SafeRelativeis applied to IDs but not to stored paths. The push and delete helpers escape/but not.or.., and no name validation runs for them. - Impact: A malformed stored path or caller-supplied name can address a different upstream resource, or write or delete outside the intended root, depending on CarrierNode's own checks (not in this repository; needs verification).
- Recommendation: Apply
SafeRelativeto stored paths, escape each segment asMountPathdoes, and reject query and fragment characters. Validate names in every push and delete helper the waythumbnailFiledoes (reject.,..and path separators).
S-018 · The role vocabulary is defined three ways, and role assignments are not checked locally · Low
- Location:
backend/auth/proxy.go:629-634(IsAdmintreatsmoderatoras admin),backend/auth/roles.go:13-32(NormalizeRole,CanManageUsers,CanAssignRole;CanAssignRoleis not called from the handlers),backend/auth/proxy.go:935-938and:965-971(client-supplied role forwarded to AuthGuard) - Description:
IsAdminadmits moderators whileNormalizeRoleandCanManageUsersdo not. The assignment check exists but is not used, and roles from requests are forwarded without a local check. - Impact: Moderators may receive access that the other definitions do not grant, and an escalation becomes possible if AuthGuard or the calling service does not enforce role rules (needs verification).
- Recommendation: Use one typed role set. Call
CanAssignRolein the managed-user handlers as defence in depth, and restrict or document what moderators can do.
S-019 · Reset codes are weak and unlimited, and TOTP secrets are stored in plaintext · Low
- Location:
backend/auth/reset.go:37(four random bytes, so 32 bits),backend/auth/reset.go:48(code printed to stdout),packages/node-backend/src/auth.js:106(randomBytes(4)),packages/python-backend/src/shared_backend/auth.py:83and:101(token_hex(4)withcompare_digest),packages/java-backend/src/main/java/com/gabriel20xx/shared/auth/ResetManager.java(per review),backend/auth/store.go:84(totp_secret TEXT),packages/node-backend/src/auth.js:30(totp_secret TEXT) - Description: Administrator reset codes are 32-bit values. They can be guessed with unlimited attempts during their five-minute life, and calling
requestagain rotates them. The code is printed to stdout, where log shipping may capture it. TOTP seeds are stored in plaintext inauth_users. - Impact: A reset code can be brute-forced within its lifetime, and second-factor seeds are exposed if the database leaks.
- Recommendation: Add an attempt counter with lockout, and require an authenticated caller to request a code. Do not print codes to stdout in production. Encrypt TOTP secrets at rest with an application key kept outside the database.
S-020 · Insecure-by-configuration options: secure cookies off by default, and database certificate verification can be disabled · Low
- Location:
packages/python-backend/src/shared_backend/authproxy.py:244(secure_cookiedefaults toFalse),packages/python-backend/src/shared_backend/authproxy.py:276(Secureapplied to cleared cookies),packages/python-backend/src/shared_backend/authproxy.py:279-281(AuthGuardSet-Cookievalues forwarded unchanged),packages/node-backend/src/config.js:48-51(DATABASE_SSL_ALLOW_INVALIDsetsrejectUnauthorized: false) - Description: The Python proxy does not set or validate
Secure,HttpOnlyorSameSiteon forwarded session cookies, andSecuredefaults to off. The Node configuration lets an environment flag turn off database certificate verification. Both are opt-in, but the defaults are the unsafe choice. - Impact: Session cookies can travel over cleartext behind an HTTPS misconfiguration, and database connections can be made without certificate checks.
- Recommendation: Default
secure_cookieto true, or derive it from the request scheme. Rewrite forwarded cookie attributes, and log a warning when database TLS verification is disabled.
S-021 · CI workflows and repository hygiene need hardening, and history contains an example file with embedded database credentials · Low
- Location:
.github/workflows/lint.yml:37,:39,:59,:61and.github/workflows/tests.yml(actions referenced by mutable tags such asactions/checkout@v4),.gitea/workflows/publish-npm.yml:71,.gitea/workflows/publish-go.yml:61,.gitea/workflows/publish-python.yml:43(registry token passed as acurl --userargument, so it is visible in process listings on the runner),.gitignore(no rules for.env*,*.pem,*.keyor.npmrc), git history: commitacde180addedmedia-backend/.env.example, which the working tree no longer contains; itsDATABASE_URLline contains embedded credentials (value redacted, needs verification of whether it was ever valid) - Description: Action references are mutable tags rather than commit SHAs. Workflow permissions are correctly
contents: read. Registry credentials appear on command lines during upload, although the npm workflow correctly writes its token to a file. The ignore rules do not block common secret files, so an accidental commit would not be stopped. The removed example file shows that a connection string with credentials was committed once. - Impact: Supply-chain exposure from tag changes, credential exposure to other processes on a shared runner, and a higher chance of future secret commits.
- Recommendation: Pin actions to commit SHAs. Pass registry credentials through a netrc or header file rather than argv. Add
.env*,*.pem,*.keyand.npmrcto.gitignore. Confirm that the historical credential is not live, and rotate it if it is.
S-022 · Media stream and thumbnail routes are unauthenticated, and upstream content types reach the app origin unchecked · Low · Open
- Location:
backend/mediacore/mediacore.go:95-97(/media/streamand/media/thumbregistered without an auth wrapper, unlike the other media routes),backend/carriernodeclient/carriernodeclient.go:202-206(upstreamContent-TypeandContent-Dispositioncopied, with noX-Content-Type-Optionsor CSP),backend/mediacore/mediacore.go:957-960(ServeFilemaps extensions such as.htmland.svgto active types) - Description: Anyone who knows a media key can download the file, and the list endpoints return those keys. Proxied responses keep the upstream content type without
nosniffor a restrictive CSP, so a file stored with an HTML or SVG type would render on the application origin. This module has no upload handler, so whether such files can exist depends on CarrierNode and its writers (needs verification). - Impact: Public access to media if the library is meant to be private, and stored XSS if active content can be placed under a media path.
- Recommendation: Add
OptionalorRequireto these routes unless public access is intended, and document the choice. SetX-Content-Type-Options: nosniffand a restrictive CSP on proxied and served media, and force attachment or an allowlisted type for non-media extensions. Also checkbackend/mediacore/mediacore.go:723, which returns the full*sharedauth.Userstruct from the request context; whether that exposes secrets depends on its JSON tags inbackend/auth(not reviewed). - Status: Open 2026-10-19 — the access part is fixed:
/media/stream(GET and HEAD) and/media/thumbnow sit behindRequireIfLoginRequired, so anonymous requests get 401 while login is required and are served while it is off (applied from the vendored ContentScanner change). Hidden media (active = FALSE) returns 404 to non-moderators on the stream, thumb and original-image lookups, and a database error in that check counts as hidden (ported from the ModerationHub change); the caller rule has a unit test, the SQL filter does not, because the test suite has no database. Other media routes (state, tags, playlists) are not covered by this rule. Files:backend/mediacore/mediacore.go,backend/mediacore/mediacore_test.go. Still open: theX-Content-Type-Options: nosniffand restrictive CSP on proxied and served media (backend/carriernodeclient/carriernodeclient.go), the active-type mapping inServeFile(backend/mediacore/mediacore.go,.htmland.svg), and the*sharedauth.UserJSON-tag question. Those need a header and content-type change in CarrierNode and the media server, and a decision on whether active types are allowed under media paths.
Notes
- Positive checks: No live credentials were found in the current tracked files. The only credential-shaped matches are identifiers (fields named
password,secretortoken), environment-variable references in.gitea/workflows/publish-python.yml, and test fixtures:packages/node-backend/test/auth.test.js:37uses the public RFC 6238 test secret, andpackages/python-backend/tests/test_core.py:38andbackend/coreconfig/coreconfig_test.go:38,132-133use short placeholder values. In git history, about twenty commits matched credential-shaped patterns; all were code identifiers or test fixtures, except the example file described in S-021. Values were masked during the review and are not reproduced here. - Web UI: No
{@html},innerHTML,evalornew Functionwas found. External links userel="noreferrer".fetchis used only inStatusWidget.svelte(same-origin relative paths with credentials included); auth requests are delegated to the consuming application through callbacks, so CSRF and session handling live in the backend. The primary-color writer builds CSS only from palette values. - Checked, no issue found: SQL is parameterised in the Go, Node and Python stores and in the mediacore queries; dynamic
SETfragments use fixed column names. Tokens and secrets come fromcrypto/rand,crypto.randomBytes, PythonsecretsandSecureRandom; nomath/rand,Math.random,random.orjava.util.Randomwas found. Session tokens are 256-bit and stored as SHA-256 hashes, and no JWT is used. Noeval,pickle,yaml.load,shell=True,os.systemorexec.Commandappears in scope. NoInsecureSkipVerifyon any TLS configuration; the only use is the websocket origin option (S-014). The Go request bodies are capped (512 KB for mediacore, 4 KB for coreconfig, 128 KB for the proxy). Outbound clients have timeouts. Logout clears cookies withHttpOnlyandSameSitein the Python proxy. No CORS configuration or debug mode was found. - Dependencies (not audited): No known-vulnerable version is asserted in this report, since no audit tool or network access was used. Versions to confirm: Go
coder/websocketv1.8.15,go-chi/chiv5.3.1,pgxv5.10.0,goosev3.27.3,golang.org/x/cryptov0.54.0 (backend/go.mod); Nodepg8.22.0 (locked inpackage-lock.json, declared^8.17.2); Pythonbcrypt>=4.2andasyncpg>=0.30with no upper bounds (packages/python-backend/pyproject.toml); Java Jackson 2.18.6, JUnit 5.10.2 (packages/java-backend/pom.xml). Rungovulncheck,npm audit,pip-auditand an OWASP dependency check. - Not verified / coverage gaps: AuthGuard's own server code (cookie attributes, rate limiting, role enforcement, session revocation on password change) is not in this repository, so every finding marked "needs verification" depends on it. Consumer wiring of
/ws,/media/*,/accessand the core-config route was not reviewed.backend/authandbackend/configwere covered by a separate pass. CarrierNode-side path validation and the file types it stores are outside the repository. JavaAuthClientcookie and redirect behaviour was assessed from code only. Test bodies were not run, and no server was started. - Excluded from analysis:
packages/web-ui/distand.svelte-kit(gitignored, not tracked),package-lock.jsonandgo.sum(versions only), andnode_modules.