From a7cc687c7bab91b9e525d9b91dc9d358afca5a28 Mon Sep 17 00:00:00 2001 From: Rasmus Dahlberg Date: Sun, 5 Jan 2025 14:34:04 +0100 Subject: fix: Don't accept timestamps that shrink --- internal/monitor/tail.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/internal/monitor/tail.go b/internal/monitor/tail.go index 98ce4e0..2ad8135 100644 --- a/internal/monitor/tail.go +++ b/internal/monitor/tail.go @@ -136,6 +136,9 @@ func (t *tail) nextConsistentState(ctx context.Context, state State) (State, err if err != nil { return State{}, fmt.Errorf("%s: get-sth: %v", t.checker.BaseURI(), err) } + if sth.Timestamp < state.Timestamp { + return State{}, fmt.Errorf("%s: get-sth: timestamp is shrinking", t.checker.BaseURI()) + } sth.LogID = state.SignedTreeHead.LogID oldSize := state.TreeSize oldRoot := state.SHA256RootHash -- cgit v1.2.3