Filter seccomp profile path from malicious .. and /

pull/6/head
Dr. Stefan Schimanski 2016-06-08 13:09:02 +02:00
parent 6489abe8b4
commit 6c54ceb0e4
1 changed files with 3 additions and 1 deletions

View File

@ -1015,7 +1015,9 @@ func (dm *DockerManager) getSecurityOpt(pod *api.Pod, ctrName string) ([]string,
return nil, fmt.Errorf("unknown seccomp profile option: %s", profile) return nil, fmt.Errorf("unknown seccomp profile option: %s", profile)
} }
file, err := ioutil.ReadFile(filepath.Join(dm.seccompProfileRoot, strings.TrimPrefix(profile, "localhost/"))) name := strings.TrimPrefix(profile, "localhost/")
fname := filepath.Join(dm.seccompProfileRoot, filepath.FromSlash(path.Clean("/"+name)))
file, err := ioutil.ReadFile(fname)
if err != nil { if err != nil {
return nil, err return nil, err
} }