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:
1 parent
4897594b87
commit
4d92a39fef
35 files changed
+907
-118
No files matched your search
@@ -37,6 +37,12 @@ internal static class ServerApp
|
||||
builder.WebHost.UseUrls((local ? "http://127.0.0.1:" : "http://0.0.0.0:") + config.Port.ToString(System.Globalization.CultureInfo.InvariantCulture));
|
||||
}
|
||||
|
||||
builder.WebHost.ConfigureKestrel(k =>
|
||||
{
|
||||
// No form of Anubis is larger than a few kilobytes; nothing is uploaded.
|
||||
k.Limits.MaxRequestBodySize = 1024 * 1024;
|
||||
k.AddServerHeader = false;
|
||||
});
|
||||
builder.Logging.ClearProviders();
|
||||
// Created by the container so it is disposed with the application and releases the log file.
|
||||
builder.Services.AddSingleton<ILoggerProvider>(_ => new JsonLogProvider(config.Data.Logs, clock, console: true));
|
||||
@@ -66,12 +72,14 @@ internal static class ServerApp
|
||||
|
||||
services.AddAuthentication(SessionAuthentication.SchemeName)
|
||||
.AddScheme<AuthenticationSchemeOptions, SessionAuthentication>(SessionAuthentication.SchemeName, null);
|
||||
services.AddAuthorization();
|
||||
// What a new page or route forgets to say stays closed: only those marked anonymous answer without a session.
|
||||
services.AddAuthorization(o => o.FallbackPolicy = o.DefaultPolicy);
|
||||
services.AddAntiforgery(o =>
|
||||
{
|
||||
o.Cookie.Name = "anubis_csrf";
|
||||
o.Cookie.SameSite = SameSiteMode.Strict;
|
||||
o.Cookie.HttpOnly = true;
|
||||
o.Cookie.SecurePolicy = CookieSecurePolicy.SameAsRequest;
|
||||
o.HeaderName = Endpoints.CsrfHeader;
|
||||
o.FormFieldName = "__csrf";
|
||||
});
|
||||
@@ -126,6 +134,8 @@ internal static class ServerApp
|
||||
private static void RegisterSecrets(StartupConfig config)
|
||||
{
|
||||
Redactor.Register(config.Db?.Password);
|
||||
Redactor.Register(config.Db?.UrlPassword);
|
||||
Redactor.Register(config.HeartbeatUrl);
|
||||
Redactor.Register(config.AdminPassword);
|
||||
foreach (var value in config.EnvironmentKeys.Values)
|
||||
{
|
||||
@@ -141,6 +151,14 @@ internal static class ServerApp
|
||||
headers["Referrer-Policy"] = "same-origin";
|
||||
headers.ContentSecurityPolicy = "default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'; img-src 'self' data:; connect-src 'self'; " +
|
||||
"font-src 'self'; frame-ancestors 'none'; form-action 'self'; base-uri 'none'";
|
||||
headers["Cross-Origin-Opener-Policy"] = "same-origin";
|
||||
headers["Permissions-Policy"] = "camera=(), geolocation=(), microphone=(), payment=(), usb=()";
|
||||
if (!Gate.IsAlwaysOpen(context.Request.Path))
|
||||
{
|
||||
// Accounts, trades, registers: nothing stays in the browser or in a proxy.
|
||||
headers.CacheControl = "no-cache, no-store";
|
||||
}
|
||||
|
||||
return next();
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user