adding waf-tag for context matching

This commit is contained in:
Roy Barda 2025-04-01 17:04:17 +03:00
parent 1610b7e7de
commit e3bf1ac96a
2 changed files with 8 additions and 0 deletions

View File

@ -44,6 +44,7 @@ struct ngx_http_cp_event_thread_ctx_t
int should_return_next_filter;
ngx_http_cp_modification_list *modifications; ///< Context's modification.
ngx_str_t waf_tag; ///< WAF tag value for the location block.
};
///

View File

@ -440,6 +440,12 @@ ngx_http_cp_req_header_handler(ngx_http_request_t *request)
return NGX_DECLINED;
}
conf = ngx_http_get_module_loc_conf(request, ngx_http_cp_attachment_module);
if (conf == NULL) {
write_dbg(DBG_LEVEL_WARNING, "Failed to get module configuration");
return NGX_DECLINED;
}
session_data_p = init_cp_session_data(request);
if (session_data_p == NULL) return NGX_DECLINED;
@ -447,6 +453,7 @@ ngx_http_cp_req_header_handler(ngx_http_request_t *request)
write_dbg(DBG_LEVEL_DEBUG, "Request header filter handling session ID: %d", session_data_p->session_id);
init_thread_ctx(&ctx, request, session_data_p, NULL);
ctx.waf_tag = conf->waf_tag;
sessions_per_minute_verdict = enforce_sessions_rate();
if (sessions_per_minute_verdict != TRAFFIC_VERDICT_INSPECT) {