Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(falco): allow plugin init_config map in json schema #3335

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions unit_tests/falco/test_configuration_schema.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,34 @@ TEST(Configuration, schema_wrong_embedded_key)
EXPECT_VALIDATION_STATUS(res, yaml_helper::validation_failed);
}

TEST(Configuration, plugin_init_config)
{
falco_configuration falco_config;
config_loaded_res res;

std::string config = R"(
plugins:
- name: k8saudit
library_path: libk8saudit.so
init_config:
maxEventSize: 262144
sslCertificate: /etc/falco/falco.pem
)";

EXPECT_NO_THROW(res = falco_config.init_from_content(config, {}));
EXPECT_VALIDATION_STATUS(res, yaml_helper::validation_ok);

config = R"(
plugins:
- name: k8saudit
library_path: libk8saudit.so
init_config: '{"maxEventSize": 262144, "sslCertificate": "/etc/falco/falco.pem"}'
)";

EXPECT_NO_THROW(res = falco_config.init_from_content(config, {}));
EXPECT_VALIDATION_STATUS(res, yaml_helper::validation_ok);
}

TEST(Configuration, schema_yaml_helper_validator)
{
yaml_helper conf;
Expand Down
9 changes: 8 additions & 1 deletion userspace/falco/config_json_schema.h
Original file line number Diff line number Diff line change
Expand Up @@ -587,7 +587,14 @@ const char config_schema_string[] = LONG_STRING_CONST(
"type": "string"
},
"init_config": {
"type": "string"
"anyOf": [
{
"type": "object"
},
{
"type": "string"
}
]
},
"open_params": {
"type": "string"
Expand Down
Loading