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:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user