|
4 | 4 | // This product includes software developed at Datadog |
5 | 5 | // (https://www.datadoghq.com/). Copyright 2021 Datadog, Inc. |
6 | 6 | #include "common.hpp" |
7 | | -#include "json_helper.hpp" |
8 | 7 | #include <engine.hpp> |
9 | 8 | #include <memory> |
10 | 9 | #include <rapidjson/document.h> |
11 | 10 | #include <subscriber/waf.hpp> |
12 | 11 |
|
13 | 12 | const std::string waf_rule = |
14 | | - 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":".*"}}]}]})"; |
| 13 | + 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.*"}}]}]})"; |
15 | 14 | const std::string waf_rule_with_data = |
16 | 15 | 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"]}]})"; |
17 | 16 |
|
@@ -704,7 +703,7 @@ TEST(EngineTest, WafSubscriptorUpdateRuleOverrideAndActions) |
704 | 703 | R"({"rules_override": [{"rules_target":[{"rule_id":"1"}], |
705 | 704 | "on_match": ["redirect"]}], "actions": [{"id": "redirect", |
706 | 705 | "type": "redirect_request", "parameters": {"status_code": "303", |
707 | | - "location": "localhost"}}]})"); |
| 706 | + "location": "https://localhost"}}]})"); |
708 | 707 | e->update(update, meta, metrics); |
709 | 708 | } |
710 | 709 |
|
|
0 commit comments