From 991ca502448f37dd8428729d315ed86976ecebc3 Mon Sep 17 00:00:00 2001 From: Yuriy Losev Date: Fri, 20 Oct 2023 15:58:15 +0400 Subject: [PATCH] Handle empty config hook section --- pkg/hook/hook_manager.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkg/hook/hook_manager.go b/pkg/hook/hook_manager.go index 5e726a83..223dd9a8 100644 --- a/pkg/hook/hook_manager.go +++ b/pkg/hook/hook_manager.go @@ -208,6 +208,10 @@ func (hm *hookManager) loadHook(hookPath string) (hook *Hook, err error) { hook.WithHookController(hookCtrl) hook.WithTmpDir(hm.TempDir()) + if hook.Config == nil { + return nil, fmt.Errorf("hook %q is marked as executable but doesn't contain config section", hook.Path) + } + hookEntry.Infof("Loaded config: %s", hook.GetConfigDescription()) return hook, nil