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
@@ -333,7 +333,7 @@
|
||||
<AntiforgeryToken />
|
||||
<input type="hidden" name="ritorno" value="/impostazioni#notizie" />
|
||||
<label for="@rule.Key">@definition.Label</label>
|
||||
<select id="@rule.Key" name="valore" disabled="@(rule.ReadOnly || Shell.IsDemo)" data-autosubmit>
|
||||
<select id="@rule.Key" name="valore" disabled="@(rule.ReadOnly || Shell.IsDemo)" data-autosubmit="@(_anyLive && rule.Value != "off" ? null : "")">
|
||||
<option value="on" selected="@(rule.Value != "off")">Accesa</option>
|
||||
<option value="off" selected="@(rule.Value == "off")">Spenta</option>
|
||||
</select>
|
||||
@@ -341,6 +341,14 @@
|
||||
{
|
||||
<span class="hint">Fissato da @rule.Source: si cambia lì.</span>
|
||||
}
|
||||
else if (!Shell.IsDemo && _anyLive && rule.Value != "off")
|
||||
{
|
||||
<p class="note">Una strategia usa soldi veri: per spegnere la regola servono la frase e la password.</p>
|
||||
<label>Scrivi: <code>@StageBook.RaisePhrase</code><input name="frase" autocomplete="off" /></label>
|
||||
<label>Password<input name="password" type="password" autocomplete="current-password" /></label>
|
||||
<label>Codice a sei cifre (se attivo)<input name="codice" inputmode="numeric" autocomplete="one-time-code" /></label>
|
||||
<button class="btn btn-small" type="submit">Salva</button>
|
||||
}
|
||||
else if (!Shell.IsDemo)
|
||||
{
|
||||
<noscript><button class="btn btn-small" type="submit">Salva</button></noscript>
|
||||
@@ -499,6 +507,8 @@
|
||||
</ol>
|
||||
<form method="post" action="/azioni/due-fattori/attiva" class="form">
|
||||
<AntiforgeryToken />
|
||||
<label for="password-nuovo-2fa">Password</label>
|
||||
<input id="password-nuovo-2fa" name="password" type="password" autocomplete="current-password" required />
|
||||
<label for="codice">Codice</label>
|
||||
<input id="codice" name="codice" inputmode="numeric" autocomplete="one-time-code" pattern="[0-9]{6}" maxlength="6" required />
|
||||
<button class="btn" type="submit">Attiva il secondo fattore</button>
|
||||
@@ -685,6 +695,8 @@
|
||||
private string? ErrorText => Errore switch
|
||||
{
|
||||
"codice" => "Il codice non è giusto. Controlla l'ora del telefono e riprova con il codice che vedi adesso.",
|
||||
"password-o-codice" => "La password o il codice non sono giusti. Controlla l'ora del telefono e riprova con il codice che vedi adesso.",
|
||||
"gia-attivo" => "Il secondo fattore è già attivo: per cambiarlo prima disattivalo.",
|
||||
"segreto" => "La chiave è scaduta: ricarica la pagina e aggiungi di nuovo Anubis nell'app.",
|
||||
"salvataggio" => "Il salvataggio non è riuscito. Controlla lo spazio libero nella cartella dei dati.",
|
||||
"impostazione" => "Questa impostazione non si può cambiare così.",
|
||||
@@ -730,6 +742,7 @@
|
||||
var value = _llm.GetValueOrDefault(key) ?? new SettingValue(key, definition.Default, false, null);
|
||||
var locked = value.ReadOnly || Shell.IsDemo;
|
||||
var shown = decimals is { } d ? Format.Number(decimal.Parse(value.Value, CultureInfo.InvariantCulture), d) : value.Value;
|
||||
var asksPassword = key == Anubis.News.NewsModelSettings.Address.Key || key == Anubis.News.NewsModelSettings.Provider.Key;
|
||||
var provider = _llm.GetValueOrDefault(Anubis.News.NewsModelSettings.Provider.Key)?.Value ?? Anubis.News.NewsModelProviders.Anthropic;
|
||||
return @<form method="post" action="/azioni/impostazioni/@key" class="form-inline">
|
||||
<AntiforgeryToken />
|
||||
@@ -737,26 +750,32 @@
|
||||
<label for="@id">@label</label>
|
||||
@if (definition.Allowed is { } choices)
|
||||
{
|
||||
<select id="@id" name="valore" disabled="@locked" data-autosubmit>
|
||||
<select id="@id" name="valore" disabled="@locked">
|
||||
@foreach (var choice in choices)
|
||||
{
|
||||
<option value="@choice" selected="@(choice == value.Value)">@ProviderName(choice)</option>
|
||||
}
|
||||
</select>
|
||||
@if (!locked)
|
||||
{
|
||||
<noscript><button class="btn btn-small" type="submit">Salva</button></noscript>
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
<input id="@id" name="valore" inputmode="@(decimals is null ? "text" : "decimal")" autocomplete="off" spellcheck="false" value="@shown"
|
||||
placeholder="@(key == Anubis.News.NewsModelSettings.Address.Key ? Anubis.News.NewsModelProviders.DefaultAddress(provider).ToString() : null)"
|
||||
readonly="@locked" required="@(key != Anubis.News.NewsModelSettings.Address.Key)" />
|
||||
@if (!locked)
|
||||
}
|
||||
@if (!locked)
|
||||
{
|
||||
@if (asksPassword)
|
||||
{
|
||||
<button class="btn btn-small" type="submit">Salva</button>
|
||||
<label for="@(id + "-password")">Password</label>
|
||||
<input id="@(id + "-password")" name="password" type="password" autocomplete="current-password" required />
|
||||
@if (_hasSecondFactor)
|
||||
{
|
||||
<label for="@(id + "-codice")">Codice</label>
|
||||
<input id="@(id + "-codice")" name="codice" inputmode="numeric" autocomplete="one-time-code" pattern="[0-9]{6}" maxlength="6" required />
|
||||
}
|
||||
}
|
||||
<button class="btn btn-small" type="submit">Salva</button>
|
||||
}
|
||||
@if (value.ReadOnly)
|
||||
{
|
||||
|
||||
@@ -182,7 +182,15 @@
|
||||
{
|
||||
<div class="row">
|
||||
<p>@Capital(SlippageTiers.Label(c.Tier)): da @Bp(c.PreviousBp) a @Bp(c.Bp). <span class="note">Misurati @Bp(c.MeasuredBp) su @c.Cases esecuzioni con soldi veri (quasi certamente tra @Bp(c.LowBp) e @Bp(c.HighBp)). Un punto base è un centesimo di punto percentuale.</span></p>
|
||||
<form method="post" action="/azioni/stime-di-costo/@c.Id/conferma" class="form-inline"><AntiforgeryToken /><button class="btn btn-small" type="submit" data-confirm="Simulatore e backtest conteranno costi più bassi. Confermi?">Conferma</button></form>
|
||||
<form method="post" action="/azioni/stime-di-costo/@c.Id/conferma" class="form-inline"><AntiforgeryToken />
|
||||
@if (_anyLive)
|
||||
{
|
||||
<p class="note">Una strategia usa soldi veri: per contare costi più bassi servono la frase e la password.</p>
|
||||
<label>Scrivi: <code>@StageBook.RaisePhrase</code><input name="frase" autocomplete="off" /></label>
|
||||
<label>Password<input name="password" type="password" autocomplete="current-password" /></label>
|
||||
<label>Codice a sei cifre (se attivo)<input name="codice" inputmode="numeric" autocomplete="one-time-code" /></label>
|
||||
}
|
||||
<button class="btn btn-small" type="submit" data-confirm="Simulatore e backtest conteranno costi più bassi. Confermi?">Conferma</button></form>
|
||||
<form method="post" action="/azioni/stime-di-costo/@c.Id/rifiuta" class="form-inline"><AntiforgeryToken /><button class="btn btn-small" type="submit">Rifiuta</button></form>
|
||||
</div>
|
||||
}
|
||||
@@ -228,6 +236,7 @@
|
||||
private DateOnly _to;
|
||||
private IReadOnlyList<string> _research = [];
|
||||
private IReadOnlyList<CostEstimate> _costs = [];
|
||||
private bool _anyLive;
|
||||
private SlippageTable _table = SlippageTable.Standard;
|
||||
|
||||
[CascadingParameter]
|
||||
@@ -248,6 +257,7 @@
|
||||
var costs = new CostBook(services.Db, Clock);
|
||||
_costs = await costs.ListAsync(ct);
|
||||
_table = await costs.TableAsync(ct);
|
||||
_anyLive = await (services.Trading?.Stages ?? new StageBook(services.Db, Clock, TradingConsent.None, (_, _, _) => Task.FromResult(false))).AnyLiveAsync(null, ct);
|
||||
_running = _trials.Any(t => !t.IsFinished);
|
||||
_family = StrategyCatalog.Find(Strategia ?? "") ?? StrategyCatalog.All[0];
|
||||
var today = DateOnly.FromDateTime(Clock.UtcNow.UtcDateTime);
|
||||
@@ -261,6 +271,9 @@
|
||||
_message = Errore switch
|
||||
{
|
||||
null => null,
|
||||
"frase-rischio" => $"Una strategia usa soldi veri: per confermare scrivi la frase «{StageBook.RaisePhrase}». Non ho cambiato nulla.",
|
||||
"password-rischio" => "Password o codice non corretti. Dopo cinque tentativi sbagliati devi aspettare 15 minuti. Non ho cambiato nulla.",
|
||||
"retrocessione-rischio" => "Una strategia con soldi veri ha una condizione di retrocessione in corso: finché dura non si aggiunge rischio. Non ho cambiato nulla.",
|
||||
"stima" => "Quella stima non aspetta più una conferma.",
|
||||
"motore" => "Il laboratorio non è attivo in questo momento: riprova tra poco.",
|
||||
TrialRequestErrors.Strategy => "Strategia sconosciuta: scegline una dall'elenco.",
|
||||
|
||||
@@ -24,6 +24,7 @@ internal static class PasswordMessages
|
||||
"corta" => $"La password è troppo corta: servono almeno {Access.Passwords.MinimumLength} caratteri.",
|
||||
"uguale" => "La nuova password deve essere diversa da quella iniziale.",
|
||||
"attuale" => "La password attuale non è giusta.",
|
||||
"attesa" => "Troppi tentativi sbagliati: aspetta 15 minuti e riprova.",
|
||||
"demo" => "Nella modalità dimostrativa la password non si cambia.",
|
||||
_ => null,
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user