Sessione salvata cifrata, copiata a «Ho finito» (#36, S4)
Il client del sito ha bisogno della sessione del browser di Febe: ora la copia c'è, cifrata e dietro un interruttore, senza cambiare nulla di predefinito. - Opzione «raccolta» (pagine predefinita, richieste): solo con «richieste» e almeno un'operazione configurata si costruiscono sessione salvata, client del sito e copia. Con Instagram nulla cambia: le dieci operazioni restano non configurate (mancano __spin_*, __req, __s, __dyn, __csr e altri). - Cookie con dominio, percorso, solo-host, Secure, HttpOnly e scadenza, mandati solo dove il browser li manderebbe (RFC 6265). - Sezione «page» del catalogo: dove la pagina tiene ogni valore; nuovi campi rev, hs, hsi, dpr, ccg, comet_req, entry_nonce. Il caricatore rifiuta un'operazione configurata con un valore di sessione senza fonte nella pagina. - Dati/sessione/sessione.json: DPAPI su Windows, AES-256-GCM in Docker (chiave da FEBE_CHIAVE_SESSIONE o chiave.bin), scrittura atomica, file illeggibile = nessuna sessione. «Scollega» la cancella; chiave.bin resta. - Copia a «Ho finito» con Network.getCookies e una sola Runtime.evaluate in sola lettura, solo da una pagina del sito e finché dura il permesso di guida. - FEBE_PASSWORD e FEBE_CHIAVE_SESSIONE non passano a Chromium, Xvfb, ffmpeg. - Sito di prova: csrftoken, cookie limitato a /api/, registro di moduli suo. - Revisione su tre lenti: 11 punti confermati, tutti corretti. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
3046b2da47
commit
c87768766c
69 files changed
+5936
-415
No files matched your search
@@ -104,6 +104,12 @@ public sealed record DesktopOptions
|
||||
/// <summary>Development: the first session after this delay instead of 2–10 minutes.</summary>
|
||||
public TimeSpan? FirstSessionDelay { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// <c>--raccolta pagine|richieste</c> (issue #36, S4): by the pages (default, as before S4) or by requests with the
|
||||
/// saved session, only for the operations the site's catalog configures.
|
||||
/// </summary>
|
||||
public CollectionRoute Collection { get; init; } = CollectionRoute.Pages;
|
||||
|
||||
/// <summary>The fixed DevTools port of Edge (fallback «edge» only), on 127.0.0.1.</summary>
|
||||
public int EdgeDebugPort { get; init; } = 9222;
|
||||
|
||||
@@ -135,6 +141,7 @@ public sealed record DesktopOptions
|
||||
TestSite = TestSite,
|
||||
TestSiteAutoLogin = TestSiteAutoLogin,
|
||||
FirstSessionDelay = FirstSessionDelay,
|
||||
Collection = Collection,
|
||||
};
|
||||
|
||||
private static Uri DefaultCdn(Uri site) => new UriBuilder(site) { Host = "127.0.0.2", Port = site.Port + 1, Path = "/" }.Uri;
|
||||
@@ -145,7 +152,8 @@ public static class DesktopCommandLine
|
||||
{
|
||||
public const string Usage =
|
||||
"Uso: Febe.exe [--nascosto] [--dati cartella] [--libreria cartella] [--browser finestra|composizione|edge] [--sviluppo]\n"
|
||||
+ " [--sito-di-prova http://127.0.0.1:8481 [--cdn-di-prova http://127.0.0.2:8482] [--accesso-di-prova]] [--prima-sessione secondi]";
|
||||
+ " [--sito-di-prova http://127.0.0.1:8481 [--cdn-di-prova http://127.0.0.2:8482] [--accesso-di-prova]] [--prima-sessione secondi]\n"
|
||||
+ " [--raccolta pagine|richieste]";
|
||||
|
||||
public static bool TryParse(string[] args, out DesktopOptions options, out string problem)
|
||||
{
|
||||
@@ -222,6 +230,19 @@ public static class DesktopCommandLine
|
||||
case "--accesso-di-prova":
|
||||
options = options with { TestSiteAutoLogin = true };
|
||||
break;
|
||||
case CollectionRouteNames.Option:
|
||||
{
|
||||
var text = Next();
|
||||
if (!CollectionRouteNames.TryParse(text, out var route))
|
||||
{
|
||||
problem = CollectionRouteNames.Problem(CollectionRouteNames.Option, text);
|
||||
return false;
|
||||
}
|
||||
|
||||
options = options with { Collection = route };
|
||||
break;
|
||||
}
|
||||
|
||||
case "--prima-sessione":
|
||||
{
|
||||
var text = Next();
|
||||
|
||||
@@ -4,6 +4,7 @@ using Febe.Browser.Cdp;
|
||||
using Febe.Browser.Hosting;
|
||||
using Febe.Core.Abstractions;
|
||||
using Febe.Core.Library;
|
||||
using Febe.Core.Security;
|
||||
using Febe.Web;
|
||||
using Febe.Web.Api;
|
||||
using Febe.Web.Connection;
|
||||
@@ -54,6 +55,12 @@ public interface IDesktopShell
|
||||
/// debugging port. False when Windows refused (the process then lives on its own, as before).
|
||||
/// </summary>
|
||||
bool EndWithFebe(System.Diagnostics.Process process);
|
||||
|
||||
/// <summary>
|
||||
/// How the saved session is encrypted on Windows (issue #36, S4, spec §13.2): DPAPI for the current user, from the
|
||||
/// desktop framework of .NET (no package). Tests on Linux pass AES-256-GCM with a key made at run time.
|
||||
/// </summary>
|
||||
ISessionProtector SessionProtector { get; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -147,6 +154,15 @@ public sealed class DesktopPlatform : IFebePlatform
|
||||
context);
|
||||
}
|
||||
|
||||
/// <summary>DPAPI for the current Windows user (the shell's): no key file, nothing in the Data folder but the session.</summary>
|
||||
public ISessionProtector CreateSessionProtector(FebePlatformContext context)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(context);
|
||||
var protector = _shell.SessionProtector;
|
||||
context.Log.Info("sessione", $"Sessione salvata: cifrata con {protector.Scheme} (solo questo utente di Windows la legge).");
|
||||
return protector;
|
||||
}
|
||||
|
||||
public void RegisterServices(IServiceCollection services, FebeApp app)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(services);
|
||||
|
||||
Reference in new issue
Block a user