Close what the security review found

A session alone could change the password, switch the second factor on or
off, send the key of the language model to another address and remove the
rules that stop purchases. Each now needs the password and the code, with
one limit on wrong attempts that a restart of the services does not clear,
and the other sessions end when the password or the factor changes.

Requests to the brokers pass a list of allowed calls, never follow a
redirect with a key and are signed by one client only. Pages are closed by
default, nothing is cached, requests are limited to 1 MB, secrets are
masked in logs and notifications, exported tables cannot run as formulas,
archives carry no sessions and the container refuses to run as root.

refs #68

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Alby96andClaude Opus 5.5 committed 2026-12-01 19:11:11 +01:00
1 parent 4897594b87
commit 4d92a39fef
35 files changed
+907 -118

No files matched your search

+13
View File
@@ -146,6 +146,12 @@ internal static partial class Endpoints
return Error(StatusCodes.Status400BadRequest, "usa_le_impostazioni", "Le soglie del modello si cambiano da Impostazioni, con la conferma quando servono soldi veri.");
}
// And for the rules of the news, and where the model's key goes: the page asks for the password.
if (Anubis.News.NewsRuleSettings.All.Any(d => d.Key == key) || Anubis.News.NewsModelSettings.All.Any(d => d.Key == key))
{
return Error(StatusCodes.Status400BadRequest, "usa_le_impostazioni", "Le regole delle notizie e il modello linguistico si cambiano da Impostazioni, con la password quando serve.");
}
return await SetSettingAsync(host, key, body.Value, context, ct).ConfigureAwait(false);
});
@@ -409,6 +415,7 @@ internal static partial class Endpoints
return;
}
context.Request.Cookies.TryGetValue(SessionAuthentication.Cookie, out var token);
using var socket = await context.WebSockets.AcceptWebSocketAsync().ConfigureAwait(false);
using var settings = bus.Subscribe<SettingChanged>(16);
using var modes = bus.Subscribe<HostChanged>(16);
@@ -418,6 +425,12 @@ internal static partial class Endpoints
{
while (socket.State == WebSocketState.Open && !aborted.IsCancellationRequested)
{
// The live status ends with the session: signed out, expired, or closed by a new password.
if (!host.IsDemo && (host.Services is not { } services || await services.Access.ValidateAsync(token, refresh: false, aborted).ConfigureAwait(false) is null))
{
break;
}
var snapshot = await shell.SnapshotAsync(aborted).ConfigureAwait(false);
var bytes = JsonSerializer.SerializeToUtf8Bytes(new { type = "status", status = snapshot }, _json);
await socket.SendAsync(bytes, WebSocketMessageType.Text, true, aborted).ConfigureAwait(false);