Fix high audit findings and port the hidden-media rule

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>
This commit is contained in:
Gabriel20xxandClaude Haiku 5.5 committed 2026-10-19 07:47:10 +00:00
1 parent 7fd2f14f91
commit 199a5efaef
12 files changed
+445 -42

No files matched your search

+9 -3
View File
@@ -211,9 +211,8 @@ export class AuthClient {
*/
middleware() {
return async (req, res, next) => {
const token = this.tokenFromRequest(req);
try {
req.authUser = await this.validate(token);
req.authUser = await this.validate(this.tokenFromRequest(req));
next();
} catch {
// Fail closed on both an invalid session and a transport/decoding
@@ -236,7 +235,14 @@ export class AuthClient {
.split(';')
.map(part => part.trim())
.find(part => part.startsWith(`${this.cookieName}=`));
if (match) return decodeURIComponent(match.slice(this.cookieName.length + 1));
if (match) {
// A malformed escape such as a bare "%" is not a usable token, so treat the cookie as absent.
try {
return decodeURIComponent(match.slice(this.cookieName.length + 1));
} catch {
return '';
}
}
}
return '';
}