v0.127.0: customer-facing escrow ceremony wizard (/backup/escrow) + Scenario-F stale-blob re-check — one-shot R reveal (no-store, typed-back), re-stage-first start order, agent version gate (MinAgent 0.88.0), escrowed-state hash re-check with card warning (never flips, never blocks); manual-confirm button removed (endpoint stays deprecated)
This commit is contained in:
@@ -435,16 +435,24 @@ func main() {
|
||||
|
||||
// --- Central hub pusher (declared early so backup closure can reference it) ---
|
||||
var hubPusher *report.Pusher
|
||||
// escrowConfirmer is hoisted so the web server (built later) can read its Scenario-F
|
||||
// stale-blob flag (SetEscrowStale below). nil when no hub is configured.
|
||||
var escrowConfirmer *report.EscrowAutoConfirmer
|
||||
if cfg.Hub.URL != "" && cfg.Hub.APIKey != "" {
|
||||
hubPusher = report.NewPusher(&cfg.Hub, logger, cfg.Logging.Level == "debug")
|
||||
// SLICE 3 — hub-verified escrow auto-confirm (long-lived: the mismatch warn dedupes per hash,
|
||||
// not per 15-min cycle). Flips offbox pending→escrowed ONLY when the hub-recorded hash of the
|
||||
// escrowed password matches the local repo password's hash; never un-confirms.
|
||||
escrowConfirmer := &report.EscrowAutoConfirmer{
|
||||
// escrowed password matches the local repo password's hash; never un-confirms. v0.127.0 adds
|
||||
// the escrowed-state STALE re-check (Scenario F — warn + card flag, never a state change).
|
||||
escrowConfirmer = &report.EscrowAutoConfirmer{
|
||||
Pending: func() bool {
|
||||
return backupMgr != nil && backupMgr.OffboxConfigured() &&
|
||||
sett.GetOffboxTarget() != nil && sett.GetOffboxTarget().EscrowState == "pending"
|
||||
},
|
||||
Escrowed: func() bool {
|
||||
return backupMgr != nil && backupMgr.OffboxConfigured() &&
|
||||
sett.GetOffboxTarget() != nil && sett.GetOffboxTarget().EscrowState == "escrowed"
|
||||
},
|
||||
LocalHash: func() (string, bool) {
|
||||
if backupMgr == nil {
|
||||
return "", false
|
||||
@@ -855,6 +863,10 @@ func main() {
|
||||
stackMgr.RecoverMigration(ctx)
|
||||
webServer.SetEncryptionKey(encKey)
|
||||
webServer.SetAppExporter(appExporter)
|
||||
// Escrow wizard (v0.127.0): the Scenario-F stale-blob flag feeds the Távoli mentés card.
|
||||
if escrowConfirmer != nil {
|
||||
webServer.SetEscrowStale(escrowConfirmer.StaleBlob)
|
||||
}
|
||||
webServer.SetIntegrationManager(integrationMgr)
|
||||
if quiesceLoop != nil {
|
||||
webServer.SetBackupTrigger(quiesceLoop) // "Mentés most" → app-consistent backup via the quiesce loop
|
||||
@@ -960,6 +972,9 @@ func main() {
|
||||
mux.Handle("/api/export/", webServer.RequireAuth(webServer.CsrfProtect(http.HandlerFunc(webServer.ServeExportAPI))))
|
||||
// Debug API routes handled by web server (debug-mode gating inside handler)
|
||||
mux.Handle("/api/debug/", webServer.RequireAuth(webServer.CsrfProtect(http.HandlerFunc(webServer.ServeDebugAPI))))
|
||||
// Escrow ceremony wizard API (v0.127.0) — session auth + CSRF on POSTs; the claim response is
|
||||
// the ONLY surface the recovery code R ever crosses (no-store, never logged).
|
||||
mux.Handle("/api/escrow/", webServer.RequireAuth(webServer.CsrfProtect(http.HandlerFunc(webServer.ServeEscrowAPI))))
|
||||
// Self-update API — accepts session auth OR hub API key (for external triggering)
|
||||
// CsrfProtect exempts Bearer-token requests automatically.
|
||||
mux.Handle("/api/selfupdate/", selfUpdateAuthMiddleware(cfg, webServer, webServer.CsrfProtect(http.HandlerFunc(apiRouter.ServeHTTP))))
|
||||
|
||||
Reference in New Issue
Block a user