Skip to content

Commit 5c62f9b

Browse files
committed
config-linux: Require at least one entry in linux.seccomp.sycalls[].names
I expect the (undocumented) intention here is to iterate through 'names' and call seccomp_rule_add(3) or similar for each name. In that case, an empty 'names' makes the whole syscall entry a no-op, and with this commit we can warn users who are validating such configs. If, on the other hand, we were comfortable with no-op syscall entries, we'd want to make 'names' OPTIONAL. Warning folks who accidentally empty (or don't set) 'names' seems more useful to me, and doesn't restrict the useful config space, so that's what I've gone with in this commit. minItems is documented in [1], and there is an example of its use in [2]: "options": { "type": "array", "minItems": 1, "items": { "type": "string" }, "uniqueItems": true }, [1]: https://tools.ietf.org/html/draft-wright-json-schema-validation-00#section-5.11 [2]: http://json-schema.org/example2.html Signed-off-by: W. Trevor King <wking@tremily.us>
1 parent cfc95a5 commit 5c62f9b

2 files changed

Lines changed: 7 additions & 2 deletions

File tree

config-linux.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -615,6 +615,7 @@ The following parameters can be specified to setup seccomp:
615615
Each entry has the following structure:
616616

617617
* **`names`** *(array of strings, REQUIRED)* - the names of the syscalls.
618+
`names` MUST contain at least one entry.
618619

619620
* **`action`** *(string, REQUIRED)* - the action for seccomp rules.
620621
A valid list of constants as of libseccomp v2.3.2 is shown below.

schema/defs-linux.json

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,8 @@
6969
"type": "array",
7070
"items": {
7171
"type": "string"
72-
}
72+
},
73+
"minItems": 1
7374
},
7475
"action": {
7576
"$ref": "#/definitions/SeccompAction"
@@ -80,7 +81,10 @@
8081
"$ref": "#/definitions/SyscallArg"
8182
}
8283
}
83-
}
84+
},
85+
"required": [
86+
"names"
87+
]
8488
},
8589
"Capability": {
8690
"description": "Linux process capabilities",

0 commit comments

Comments
 (0)