From 06a023ca6610555b7cdb004c3077e7fb9b5e0c5e Mon Sep 17 00:00:00 2001 From: James Shubin Date: Wed, 18 Sep 2024 21:39:33 -0400 Subject: [PATCH] engine: resources: sysctl: Be more careful about dir path More validation is not bad! --- engine/resources/sysctl.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/engine/resources/sysctl.go b/engine/resources/sysctl.go index 4fa2e72a..a8076902 100644 --- a/engine/resources/sysctl.go +++ b/engine/resources/sysctl.go @@ -47,6 +47,9 @@ import ( func init() { engine.RegisterResource("sysctl", func() engine.Res { return &SysctlRes{} }) + if !strings.HasPrefix(SysctlConfDir, "/") { + panic("the SysctlConfDir does not start with a slash") + } if !strings.HasSuffix(SysctlConfDir, "/") { panic("the SysctlConfDir does not end with a slash") }