v0.108.0: hub-verified escrow auto-confirm on current-password hash match (SLICE 3)
EscrowAutoConfirmer flips pending->escrowed ONLY when sha256(local repo password) matches the ACK's restic_pw_sha256 (blob-presence alone never confirms — red-proofed). Mismatch warns once per hash naming the ceremony; never un-confirms; wipes the staged secret on flip. Pinned cross-repo hash vector; manual confirm deprecated to a legacy-blob fallback. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PSK5g6qYLknKj8u3QAFEr6
This commit is contained in:
@@ -384,6 +384,32 @@ func main() {
|
||||
var hubPusher *report.Pusher
|
||||
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{
|
||||
Pending: func() bool {
|
||||
return backupMgr != nil && backupMgr.OffboxConfigured() &&
|
||||
sett.GetOffboxTarget() != nil && sett.GetOffboxTarget().EscrowState == "pending"
|
||||
},
|
||||
LocalHash: func() (string, bool) {
|
||||
if backupMgr == nil {
|
||||
return "", false
|
||||
}
|
||||
return backupMgr.OffboxRepoPasswordHash()
|
||||
},
|
||||
Flip: func() error {
|
||||
return sett.UpdateOffboxStatus(func(o *settings.OffboxTarget) { o.EscrowState = "escrowed" })
|
||||
},
|
||||
Wipe: func(ctx context.Context) error {
|
||||
ac, err := agentapi.New(cfg.LocalAPI.Endpoint, cfg.LocalAPI.Token, cfg.LocalAPI.Fingerprint)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return ac.WipeStagedEscrowSecret(ctx)
|
||||
},
|
||||
Logger: logger,
|
||||
}
|
||||
// Wire hub verification: update settings when hub reports customer status
|
||||
hubPusher.OnPushResponse = func(resp *report.PushResponse) {
|
||||
if resp.CustomerBlocked {
|
||||
@@ -414,6 +440,9 @@ func main() {
|
||||
Logger: logger,
|
||||
}
|
||||
cr.Reconcile(resp.ConfigVersion)
|
||||
// SLICE 3: run the escrow auto-confirm on the same ACK (after the config refresh decision —
|
||||
// a refresh-restart re-enters here anyway on the next cycle).
|
||||
escrowConfirmer.Reconcile(resp.Escrow)
|
||||
}
|
||||
// Wire hub push status into alert manager for dashboard alerts
|
||||
alertMgr.SetHubPushStatus(func() web.HubPushStatusData {
|
||||
|
||||
Reference in New Issue
Block a user