diff --git a/appsec/tests/helper/client_test.cpp b/appsec/tests/helper/client_test.cpp index b12cf89e16..8303494bec 100644 --- a/appsec/tests/helper/client_test.cpp +++ b/appsec/tests/helper/client_test.cpp @@ -637,8 +637,8 @@ TEST(ClientTest, EventWithMultipleActions) EXPECT_EQ(msg_res->actions.size(), 3); // Block is not generated since there is a redirect EXPECT_STREQ(msg_res->actions[0].verdict.c_str(), "redirect"); - EXPECT_STREQ( - msg_res->actions[0].parameters["location"].c_str(), "localhost"); + EXPECT_STREQ(msg_res->actions[0].parameters["location"].c_str(), + "https://localhost"); EXPECT_STREQ( msg_res->actions[0].parameters["status_code"].c_str(), "303"); EXPECT_STREQ(msg_res->actions[1].verdict.c_str(), diff --git a/appsec/tests/helper/engine_test.cpp b/appsec/tests/helper/engine_test.cpp index 1778e17337..06a8b0c576 100644 --- a/appsec/tests/helper/engine_test.cpp +++ b/appsec/tests/helper/engine_test.cpp @@ -4,14 +4,13 @@ // This product includes software developed at Datadog // (https://www.datadoghq.com/). Copyright 2021 Datadog, Inc. #include "common.hpp" -#include "json_helper.hpp" #include #include #include #include const std::string waf_rule = - R"({"version":"2.1","rules":[{"id":"1","name":"rule1","tags":{"type":"flow1","category":"category1"},"conditions":[{"operator":"match_regex","parameters":{"inputs":[{"address":"arg1","key_path":[]}],"regex":"^string.*"}},{"operator":"match_regex","parameters":{"inputs":[{"address":"arg2","key_path":[]}],"regex":".*"}}]}]})"; + R"({"version":"2.1","rules":[{"id":"1","name":"rule1","tags":{"type":"flow1","category":"category1"},"conditions":[{"operator":"match_regex","parameters":{"inputs":[{"address":"arg1","key_path":[]}],"regex":"^string.*"}},{"operator":"match_regex","parameters":{"inputs":[{"address":"arg2","key_path":[]}],"regex":".*"}}]},{"id":"2","name":"rule2","tags":{"type":"flow2","category":"category2"},"conditions":[{"operator":"match_regex","parameters":{"inputs":[{"address":"arg3","key_path":[]}],"regex":"^string.*"}}]}]})"; const std::string waf_rule_with_data = R"({"version":"2.1","rules":[{"id":"blk-001-001","name":"Block IP Addresses","tags":{"type":"block_ip","category":"security_response"},"conditions":[{"parameters":{"inputs":[{"address":"http.client_ip"}],"data":"blocked_ips"},"operator":"ip_match"}],"transformers":[],"on_match":["block"]}]})"; @@ -704,7 +703,7 @@ TEST(EngineTest, WafSubscriptorUpdateRuleOverrideAndActions) R"({"rules_override": [{"rules_target":[{"rule_id":"1"}], "on_match": ["redirect"]}], "actions": [{"id": "redirect", "type": "redirect_request", "parameters": {"status_code": "303", - "location": "localhost"}}]})"); + "location": "https://localhost"}}]})"); e->update(update, meta, metrics); } diff --git a/appsec/tests/helper/main.cpp b/appsec/tests/helper/main.cpp index 5be5e7a7e9..064f9e1ce5 100644 --- a/appsec/tests/helper/main.cpp +++ b/appsec/tests/helper/main.cpp @@ -190,7 +190,7 @@ std::string create_sample_rules_ok() "id": "redirect", "type": "redirect_request", "parameters": { - "location": "localhost" + "location": "https://localhost" } } ] diff --git a/appsec/tests/helper/remote_config/listeners/engine_listener_test.cpp b/appsec/tests/helper/remote_config/listeners/engine_listener_test.cpp index 1e3a3d4bb1..48281376ed 100644 --- a/appsec/tests/helper/remote_config/listeners/engine_listener_test.cpp +++ b/appsec/tests/helper/remote_config/listeners/engine_listener_test.cpp @@ -6,18 +6,16 @@ #include "../../common.hpp" #include "../mocks.hpp" -#include "base64.h" #include "engine.hpp" #include "json_helper.hpp" #include "remote_config/exception.hpp" #include "remote_config/listeners/engine_listener.hpp" -#include "remote_config/product.hpp" #include "subscriber/waf.hpp" #include #include const std::string waf_rule = - R"({"version":"2.1","rules":[{"id":"1","name":"rule1","tags":{"type":"flow1","category":"category1"},"conditions":[{"operator":"match_regex","parameters":{"inputs":[{"address":"arg1","key_path":[]}],"regex":".*"}}]}]})"; + R"({"version":"2.1","rules":[{"id":"1","name":"rule1","tags":{"type":"flow1","category":"category1"},"conditions":[{"operator":"match_regex","parameters":{"inputs":[{"address":"arg1","key_path":[]}],"regex":".*"}}]},{"id":"2","name":"rule2","tags":{"type":"flow2","category":"category2"},"conditions":[{"operator":"match_regex","parameters":{"inputs":[{"address":"dummy","key_path":[]}],"regex":".*"}}]}]})"; namespace dds::remote_config { @@ -978,7 +976,7 @@ TEST(RemoteConfigEngineListener, EngineRuleOverrideAndActionsUpdate) } const std::string update = R"({"actions": [{"id": "redirect", "type": "redirect_request", "parameters": - {"status_code": "303", "location": "localhost"}}],"rules_override": + {"status_code": "303", "location": "https://localhost"}}],"rules_override": [{"rules_target": [{"rule_id": "1"}], "on_match": ["redirect"]}]})"; listener.on_update(get_config("ASM", update));