Reject shell-unsafe paths in FreeBSD rc.d install

Validate executable and state directory paths before rendering the
rc.d script so crafted values cannot inject shell syntax.

Signed-off-by: Bryan Frimin <bryan@probo.com>
This commit is contained in:
Bryan Frimin
2026-05-26 09:34:52 -07:00
parent 27cccd33aa
commit 941ab121da
2 changed files with 48 additions and 0 deletions

View File

@@ -59,6 +59,10 @@ func Install(cfg Config) error {
return errors.New("state directory is required")
}
if err := validateServicePaths(cfg); err != nil {
return err
}
rcTmpl, err := template.New("rc").Parse(rcScriptTmpl)
if err != nil {
return fmt.Errorf("cannot parse rc.d template: %w", err)