From ff416106257d0e5f88e87f8e6732b6feaee8b8b4 Mon Sep 17 00:00:00 2001 From: Jonny Stoten Date: Thu, 25 Jul 2024 15:43:54 +0100 Subject: [PATCH] Don't error if TUF client can't initialize on boot This stops a crash loop if the TUF repo is broken --- pkg/handler/validate.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pkg/handler/validate.go b/pkg/handler/validate.go index e72e50a..da71e67 100644 --- a/pkg/handler/validate.go +++ b/pkg/handler/validate.go @@ -50,7 +50,10 @@ func NewValidateHandler(opts *ValidateHandlerOptions) (http.Handler, error) { // TODO: this pre-loading works for the root, targets, snapshot, and timestamp roles, but not for delegated roles. _, err := handler.createTUFClient() if err != nil { - return nil, err + // if this failed, don't return an error, just log it and continue + // this prevents the server from getting into a crash loop if the TUF repo is down or broken, + // and we can still recover if the TUF repo comes back up. + klog.ErrorS(err, "failed to initialize TUF client") } klog.Infof("validate handler initialized with %s TUF root", opts.TUFRoot)