genpolicy: add easy way to allow CloseStdinRequest

For example, Kata CI's k8s-copy-file.bats transfers files between the
Host and the Guest using "kubectl exec", and that results in
CloseStdinRequest being called from the Host.

Signed-off-by: Dan Mihai <dmihai@microsoft.com>
This commit is contained in:
Dan Mihai 2024-02-07 21:58:13 +00:00
parent 8401adb113
commit dab567bdfa
3 changed files with 8 additions and 0 deletions

View File

@ -299,6 +299,7 @@
"commands": [],
"regex": []
},
"CloseStdinRequest": false,
"ReadStreamRequest": false,
"WriteStreamRequest": false
}

View File

@ -1143,6 +1143,10 @@ ExecProcessRequest {
print("ExecProcessRequest 3: true")
}
CloseStdinRequest {
policy_data.request_defaults.CloseStdinRequest == true
}
ReadStreamRequest {
policy_data.request_defaults.ReadStreamRequest == true
}

View File

@ -324,6 +324,9 @@ pub struct RequestDefaults {
/// Commands allowed to be executed by the Host in all Guest containers.
pub ExecProcessRequest: ExecProcessRequestDefaults,
/// Allow the Host to close stdin for a container. Typically used with WriteStreamRequest.
pub CloseStdinRequest: bool,
/// Allow Host reading from Guest containers stdout and stderr.
pub ReadStreamRequest: bool,