new(userspace/falco): check lua data when handling gRPC

Signed-off-by: Leonardo Di Donato <leodidonato@gmail.com>
This commit is contained in:
Leonardo Di Donato
2019-09-13 12:04:37 +00:00
committed by Leo Di Donato
parent bef491ae20
commit 5e511d8f09

View File

@@ -304,15 +304,19 @@ int falco_outputs::handle_http(lua_State *ls)
// TODO(fntlnz, leodido): verify if this works with k8s_audit as source
int falco_outputs::handle_grpc(lua_State *ls)
{
// check parameters
if(!lua_istable(ls, -1) ||
!lua_istable(ls, -2) ||
!lua_isstring(ls, -3) ||
!lua_isstring(ls, -4) ||
!lua_isstring(ls, -5) ||
!lua_isstring(ls, -6))
{
lua_pushstring(ls, "Invalid arguments passed to handle_grpc()");
lua_error(ls);
}
response grpc_res = response();
// TODO(fntlnz, leodido): do the checks and make sure all the fields are sent
// fixme > check parameters later
// if(!lua_isstring(ls, -1) ||
// !lua_isstring(ls, -2))
// {
// lua_pushstring(ls, "Invalid arguments passed to handle_grpc()");
// lua_error(ls);
// }
// todo(leodido, fntlnz) > pass the ID (?)
// grpc_res.set_id("...");