Add additional option to manipulate file extension recognition to prevent leaking file extension to uri
RudW0lf opened this issue · 3 comments
Hi!
I noted that daemon able use only .sh files without extension:
// ResolveScript is resolving the target script.
func ResolveScript(dir, name string) (string, error) {
if path.Ext(name) == "" { <------------
name += ".sh"
}
script := path.Clean(path.Join(dir, name))
if !strings.HasPrefix(script, dir) {
return "", errors.New("Invalid script path: " + name)
}
if _, err := os.Stat(script); os.IsNotExist(err) {
return "", errors.New("Script not found: " + script)
}
return script, nil
}
Could you add additional config string to manage that option?
I use python scripts, but don`t want to show ".py" inside uri . . .
Hi! It's a good idea. I will add this for the next release.
You can test the new WHD_HOOK_DEFAULT_EXT
environment variable or -hook-default-ext
parameter on the last commit.
Thank You!