Skip to content

Commit ce1d438

Browse files
victorhorazimmerle
authored andcommitted
Fix audit_log not generated for disruptive actions
1 parent 24e830e commit ce1d438

5 files changed

+11
-16
lines changed

CHANGES

+2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
v1.0.x - YYYY-MMM-DD (To be released)
22
-------------------------------------
33

4+
- Fix audit_log not generated for disruptive actions
5+
[Issue #170, #2220, #2237 - @victorhora]
46
- Exit more gracefully if uri length is zero
57
[@martinhsv]
68

src/ngx_http_modsecurity_header_filter.c

+3-4
Original file line numberDiff line numberDiff line change
@@ -420,10 +420,6 @@ ngx_http_modsecurity_header_filter(ngx_http_request_t *r)
420420

421421
/* XXX: if NOT_MODIFIED, do we need to process it at all? see xslt_header_filter() */
422422

423-
if (r->error_page) {
424-
return ngx_http_next_header_filter(r);
425-
}
426-
427423
ctx = ngx_http_get_module_ctx(r, ngx_http_modsecurity_module);
428424

429425
dd("header filter, recovering ctx: %p", ctx);
@@ -527,6 +523,9 @@ ngx_http_modsecurity_header_filter(ngx_http_request_t *r)
527523
msc_process_response_headers(ctx->modsec_transaction, status, http_response_ver);
528524
ngx_http_modsecurity_pcre_malloc_done(old_pool);
529525
ret = ngx_http_modsecurity_process_intervention(ctx->modsec_transaction, r);
526+
if (r->error_page) {
527+
return ngx_http_next_header_filter(r);
528+
}
530529
if (ret > 0) {
531530
return ret;
532531
}

src/ngx_http_modsecurity_log.c

-4
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,6 @@ ngx_http_modsecurity_log_handler(ngx_http_request_t *r)
4141
ngx_http_modsecurity_ctx_t *ctx;
4242
ngx_http_modsecurity_conf_t *mcf;
4343

44-
if (r->error_page) {
45-
return NGX_OK;
46-
}
47-
4844
dd("catching a new _log_ phase handler");
4945

5046
mcf = ngx_http_get_module_loc_conf(r, ngx_http_modsecurity_module);

src/ngx_http_modsecurity_pre_access.c

+3-4
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,6 @@ ngx_http_modsecurity_pre_access_handler(ngx_http_request_t *r)
4848
ngx_http_modsecurity_ctx_t *ctx;
4949
ngx_http_modsecurity_conf_t *mcf;
5050

51-
if (r->error_page) {
52-
return NGX_DECLINED;
53-
}
54-
5551
dd("catching a new _preaccess_ phase handler");
5652

5753
mcf = ngx_http_get_module_loc_conf(r, ngx_http_modsecurity_module);
@@ -207,6 +203,9 @@ ngx_http_modsecurity_pre_access_handler(ngx_http_request_t *r)
207203
ngx_http_modsecurity_pcre_malloc_done(old_pool);
208204

209205
ret = ngx_http_modsecurity_process_intervention(ctx->modsec_transaction, r);
206+
if (r->error_page) {
207+
return NGX_DECLINED;
208+
}
210209
if (ret > 0) {
211210
return ret;
212211
}

src/ngx_http_modsecurity_rewrite.c

+3-4
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,6 @@ ngx_http_modsecurity_rewrite_handler(ngx_http_request_t *r)
2727
ngx_http_modsecurity_ctx_t *ctx;
2828
ngx_http_modsecurity_conf_t *mcf;
2929

30-
if (r->error_page) {
31-
return NGX_DECLINED;
32-
}
33-
3430
mcf = ngx_http_get_module_loc_conf(r, ngx_http_modsecurity_module);
3531
if (mcf == NULL || mcf->enable != 1) {
3632
dd("ModSecurity not enabled... returning");
@@ -204,6 +200,9 @@ ngx_http_modsecurity_rewrite_handler(ngx_http_request_t *r)
204200
ngx_http_modsecurity_pcre_malloc_done(old_pool);
205201
dd("Processing intervention with the request headers information filled in");
206202
ret = ngx_http_modsecurity_process_intervention(ctx->modsec_transaction, r);
203+
if (r->error_page) {
204+
return NGX_DECLINED;
205+
}
207206
if (ret > 0) {
208207
return ret;
209208
}

0 commit comments

Comments
 (0)