fix 11646 to check volume path in server side
| ... | ... |
@@ -52,6 +52,7 @@ func TestParseBindMount(t *testing.T) {
|
| 52 | 52 |
{"name:/tmp", "external", "/tmp", "", "name", "external", "", true, false},
|
| 53 | 53 |
{"name:/tmp:ro", "local", "/tmp", "", "name", "local", "", false, false},
|
| 54 | 54 |
{"local/name:/tmp:rw", "", "/tmp", "", "local/name", "local", "", true, false},
|
| 55 |
+ {"/tmp:tmp", "", "", "", "", "", "", true, true},
|
|
| 55 | 56 |
} |
| 56 | 57 |
|
| 57 | 58 |
for _, c := range cases {
|
| ... | ... |
@@ -81,6 +81,11 @@ func parseBindMount(spec string, mountLabel string, config *runconfig.Config) (* |
| 81 | 81 |
return nil, fmt.Errorf("Invalid volume specification: %s", spec)
|
| 82 | 82 |
} |
| 83 | 83 |
|
| 84 |
+ //validate the volumes destination path |
|
| 85 |
+ if !filepath.IsAbs(bind.Destination) {
|
|
| 86 |
+ return nil, fmt.Errorf("Invalid volume destination path: %s mount path must be absolute.", bind.Destination)
|
|
| 87 |
+ } |
|
| 88 |
+ |
|
| 84 | 89 |
name, source, err := parseVolumeSource(arr[0]) |
| 85 | 90 |
if err != nil {
|
| 86 | 91 |
return nil, err |