From 069803ec47028f6784f1e14889f182732805ccde Mon Sep 17 00:00:00 2001 From: Xe Iaso Date: Sun, 7 Sep 2025 15:42:23 +0000 Subject: [PATCH] fix(challenge): demote temporal assurance to 80% instead of 95% Signed-off-by: Xe Iaso --- lib/challenge/metarefresh/metarefresh.go | 2 +- lib/challenge/preact/preact.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/challenge/metarefresh/metarefresh.go b/lib/challenge/metarefresh/metarefresh.go index 5564ae28..75ac70fc 100644 --- a/lib/challenge/metarefresh/metarefresh.go +++ b/lib/challenge/metarefresh/metarefresh.go @@ -43,7 +43,7 @@ func (i *Impl) Issue(r *http.Request, lg *slog.Logger, in *challenge.IssueInput) } func (i *Impl) Validate(r *http.Request, lg *slog.Logger, in *challenge.ValidateInput) error { - wantTime := in.Challenge.IssuedAt.Add(time.Duration(in.Rule.Challenge.Difficulty) * 950 * time.Millisecond) + wantTime := in.Challenge.IssuedAt.Add(time.Duration(in.Rule.Challenge.Difficulty) * 800 * time.Millisecond) if time.Now().Before(wantTime) { return challenge.NewError("validate", "insufficent time", fmt.Errorf("%w: wanted user to wait until at least %s", challenge.ErrFailed, wantTime.Format(time.RFC3339))) diff --git a/lib/challenge/preact/preact.go b/lib/challenge/preact/preact.go index a01ba2e3..0276d7d2 100644 --- a/lib/challenge/preact/preact.go +++ b/lib/challenge/preact/preact.go @@ -57,7 +57,7 @@ func (i *impl) Issue(r *http.Request, lg *slog.Logger, in *challenge.IssueInput) } func (i *impl) Validate(r *http.Request, lg *slog.Logger, in *challenge.ValidateInput) error { - wantTime := in.Challenge.IssuedAt.Add(time.Duration(in.Rule.Challenge.Difficulty) * 95 * time.Millisecond) + wantTime := in.Challenge.IssuedAt.Add(time.Duration(in.Rule.Challenge.Difficulty) * 80 * time.Millisecond) if time.Now().Before(wantTime) { return challenge.NewError("validate", "insufficent time", fmt.Errorf("%w: wanted user to wait until at least %s", challenge.ErrFailed, wantTime.Format(time.RFC3339)))