mirror of
https://github.com/openappsec/attachment.git
synced 2025-06-28 16:41:03 +03:00
adding waf-tag for context matching
This commit is contained in:
parent
82d382ec18
commit
1610b7e7de
@ -223,7 +223,8 @@ ngx_http_cp_req_header_handler_thread(void *_ctx)
|
||||
&(request->headers_in.headers.part),
|
||||
REQUEST_HEADER,
|
||||
session_data_p->session_id,
|
||||
&num_messages_sent
|
||||
&num_messages_sent,
|
||||
&ctx->waf_tag
|
||||
);
|
||||
if (send_header_result != NGX_OK) {
|
||||
write_dbg(
|
||||
@ -412,7 +413,8 @@ ngx_http_cp_res_header_filter_thread(void *_ctx)
|
||||
&request->headers_out.headers.part,
|
||||
RESPONSE_HEADER,
|
||||
session_data_p->session_id,
|
||||
&num_messages_sent
|
||||
&num_messages_sent,
|
||||
&ctx->waf_tag
|
||||
);
|
||||
if (send_header_result != NGX_OK) {
|
||||
write_dbg(
|
||||
|
@ -412,6 +412,7 @@ ngx_http_cp_req_header_handler(ngx_http_request_t *request)
|
||||
int res;
|
||||
static int is_failure_state_initialized = 0;
|
||||
static int is_metric_data_initialized = 0;
|
||||
ngx_cp_attachment_conf_t *conf;
|
||||
|
||||
clock_gettime(CLOCK_REALTIME, &hook_time_begin);
|
||||
|
||||
|
@ -138,6 +138,7 @@ ngx_http_cp_content_length_sender(
|
||||
/// - #RESPONSE_HEADER
|
||||
/// @param[in] cur_request_id Request session's Id.
|
||||
/// @param[in, out] num_messages_sent Number of messages sent will be saved onto this parameter.
|
||||
/// @param[in, out] waf_tag WAF tag to be sent.
|
||||
/// @returns ngx_int_t
|
||||
/// - #NGX_OK
|
||||
/// - #NGX_ERROR
|
||||
@ -147,7 +148,8 @@ ngx_http_cp_header_sender(
|
||||
ngx_list_part_t *headers,
|
||||
ngx_http_chunk_type_e header_type,
|
||||
uint32_t cur_request_id,
|
||||
ngx_uint_t *num_messages_sent
|
||||
ngx_uint_t *num_messages_sent,
|
||||
ngx_str_t *waf_tag
|
||||
);
|
||||
|
||||
///
|
||||
|
@ -30,6 +30,7 @@ typedef struct {
|
||||
ngx_flag_t enable; ///< Flags if the configuration enabled.
|
||||
ngx_int_t num_of_workers; ///< Number of workers.
|
||||
ngx_uint_t current_loc_config_version; ///< NGINX configuration version.
|
||||
ngx_str_t waf_tag; ///< WAF tag value for the location block.
|
||||
} ngx_cp_attachment_conf_t;
|
||||
|
||||
///
|
||||
@ -120,6 +121,14 @@ static ngx_command_t ngx_cp_attachment_commands[] = {
|
||||
offsetof(ngx_cp_attachment_conf_t, num_of_workers),
|
||||
NULL
|
||||
},
|
||||
{
|
||||
ngx_string("waf_tag"),
|
||||
NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1,
|
||||
ngx_conf_set_str_slot,
|
||||
NGX_HTTP_LOC_CONF_OFFSET,
|
||||
offsetof(ngx_cp_attachment_conf_t, waf_tag),
|
||||
NULL
|
||||
},
|
||||
ngx_null_command
|
||||
};
|
||||
|
||||
@ -210,6 +219,7 @@ ngx_cp_attachment_create_conf(ngx_conf_t *conf)
|
||||
module_conf->enable = NGX_CONF_UNSET;
|
||||
module_conf->num_of_workers = 0;
|
||||
module_conf->current_loc_config_version = current_config_version;
|
||||
ngx_str_null(&module_conf->waf_tag);
|
||||
write_dbg(DBG_LEVEL_TRACE, "Successfully created attachment module configuration");
|
||||
return module_conf;
|
||||
}
|
||||
@ -270,6 +280,7 @@ ngx_cp_attachment_merge_conf(ngx_conf_t *configure, void *curr, void *next)
|
||||
|
||||
ngx_conf_merge_value(conf->enable, prev->enable, NGX_CONF_UNSET);
|
||||
ngx_conf_merge_value(conf->num_of_workers, prev->num_of_workers, ngx_ncpu);
|
||||
ngx_conf_merge_str_value(conf->waf_tag, prev->waf_tag, "");
|
||||
|
||||
write_dbg(DBG_LEVEL_TRACE, "Successfully set attachment module configuration in nginx configuration chain");
|
||||
return NGX_CONF_OK;
|
||||
|
Loading…
x
Reference in New Issue
Block a user