Skip to content

Commit 89907b6

Browse files
author
Mrunal Patel
committed
Merge pull request #76 from Mashimiao/runtime-test-readonly-path-validation
runtimetest: add readonly path validation
2 parents 5e5e247 + 447a73b commit 89907b6

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

cmd/runtimetest/main.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,17 @@ func validateMaskedPaths(spec *rspec.Spec) error {
233233
return nil
234234
}
235235

236+
func validateROPaths(spec *rspec.Spec) error {
237+
fmt.Println("validating readonlyPaths")
238+
for _, v := range spec.Linux.ReadonlyPaths {
239+
err := testWriteAccess(v)
240+
if err == nil {
241+
return fmt.Errorf("%v should be readonly", v)
242+
}
243+
}
244+
return nil
245+
}
246+
236247
func main() {
237248
spec, err := loadSpecConfig()
238249
if err != nil {
@@ -247,6 +258,7 @@ func main() {
247258
validateRlimits,
248259
validateSysctls,
249260
validateMaskedPaths,
261+
validateROPaths,
250262
}
251263

252264
for _, v := range validations {

0 commit comments

Comments
 (0)