Skip to content

Commit

Permalink
Upgrade libddwaf to v1.22.0 (#3007)
Browse files Browse the repository at this point in the history
  • Loading branch information
Anilm3 authored Dec 19, 2024
1 parent 0d57b55 commit dc9911b
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 6 deletions.
2 changes: 1 addition & 1 deletion appsec/tests/helper/client_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2760,7 +2760,7 @@ TEST(ClientTest, RaspCalls)
dynamic_cast<network::request_shutdown::response *>(res.get());

EXPECT_EQ(msg_res->metrics.size(), 3);
EXPECT_GT(msg_res->metrics[metrics::waf_duration], 0.0);
EXPECT_GE(msg_res->metrics[metrics::waf_duration], 0.0);
EXPECT_EQ(msg_res->metrics[metrics::rasp_rule_eval], 1);
EXPECT_GE(msg_res->metrics[metrics::rasp_duration], 0.0);
}
Expand Down
6 changes: 4 additions & 2 deletions appsec/tests/helper/waf_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,10 @@ TEST(WafTest, RunWithTimeout)

EXPECT_CALL(submitm, submit_span_metric(metrics::rasp_timeout, 1));
EXPECT_CALL(submitm, submit_span_metric(metrics::rasp_rule_eval, 1.0));
EXPECT_CALL(submitm, submit_span_metric(metrics::waf_duration, 0.0));
EXPECT_CALL(submitm, submit_span_metric(metrics::rasp_duration, 0.0));
// Since v1.22.0 libddwaf will still attempt to run denylists, which
// will cause the duration to be non-zero
EXPECT_CALL(submitm, submit_span_metric(metrics::waf_duration, _));
EXPECT_CALL(submitm, submit_span_metric(metrics::rasp_duration, _));
parameter_view pv(p);
dds::event e;
bool is_rasp = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ trait CommonTests {

@Test
void 'test blocking and stack generation'() {
HttpRequest req = container.buildReq('/generate_stack.php?id=user2020').GET().build()
HttpRequest req = container.buildReq('/generate_stack.php?id=stack_user').GET().build()
def trace = container.traceFromRequest(req, ofString()) { HttpResponse<String> re ->
assert re.statusCode() == 403
assert re.body().contains('blocked')
Expand Down
13 changes: 12 additions & 1 deletion appsec/tests/integration/src/test/waf/recommended.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
"address": "usr.id"
}
],
"data": "blocked_users"
"data": "blocked_users_with_stack"
},
"operator": "exact_match"
}
Expand Down Expand Up @@ -6894,6 +6894,17 @@
}
]
},
{
"id": "blocked_users_with_stack",
"type": "data_with_expiration",
"data": [
{
"value": "stack_user",
"expiration": 0
}
]
},

{
"id": "redirected_users",
"type": "data_with_expiration",
Expand Down
2 changes: 1 addition & 1 deletion appsec/third_party/libddwaf
Submodule libddwaf updated 900 files

0 comments on commit dc9911b

Please sign in to comment.