From c1cf2e8d4f8ee9627507842acd7e63ef63a8a153 Mon Sep 17 00:00:00 2001 From: Yarden Shoham Date: Wed, 19 Oct 2022 20:00:04 +0000 Subject: [PATCH] fix(plugins): trim whitespace in `open_params` `open_params` is read from the falco YAML configuration file and parsed using Go's URL. For example: https://github.com/falcosecurity/plugins/blob/c349be6e84d2230698b5ca5d51ddadcda42c5e21/plugins/k8saudit/pkg/k8saudit/source.go#L41-L42 Go's URL parser does not handle whitespace, so if a user defines the `open_params` in the falco configuration file as follows ```yaml open_params: > /file/path ``` the parser returns an error. To avoid this, we now trim this parameter so no whitespace will be left for Go's URL parser to error out on. For reference see #2262. Signed-off-by: Yarden Shoham --- userspace/falco/configuration.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/userspace/falco/configuration.h b/userspace/falco/configuration.h index 54e57a7851e..b0bd308fec7 100644 --- a/userspace/falco/configuration.h +++ b/userspace/falco/configuration.h @@ -400,7 +400,8 @@ namespace YAML { if(node["open_params"] && !node["open_params"].IsNull()) { - rhs.m_open_params = node["open_params"].as(); + string open_params = node["open_params"].as(); + rhs.m_open_params = trim(open_params); } return true;