From 6bfa0a09af3aa69c5be826a9d897d5c569735a29 Mon Sep 17 00:00:00 2001 From: Ma Shimiao Date: Wed, 26 Oct 2016 10:06:07 +0800 Subject: [PATCH] validate: add maskedpaths and readonlypaths check Signed-off-by: Ma Shimiao --- validate/validate.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/validate/validate.go b/validate/validate.go index e9325685..bce44d97 100644 --- a/validate/validate.go +++ b/validate/validate.go @@ -384,6 +384,18 @@ func (v *Validator) CheckLinux() (msgs []string) { msgs = append(msgs, "rootfsPropagation must be empty or one of \"private|rprivate|slave|rslave|shared|rshared\"") } + for _, maskedPath := range v.spec.Linux.MaskedPaths { + if !strings.HasPrefix(maskedPath, "/") { + msgs = append(msgs, "maskedPath %v is not an absolute path", maskedPath) + } + } + + for _, readonlyPath := range v.spec.Linux.ReadonlyPaths { + if !strings.HasPrefix(readonlyPath, "/") { + msgs = append(msgs, "readonlyPath %v is not an absolute path", readonlyPath) + } + } + return }