Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restore method name for error_page in audit log #270

Closed
wants to merge 1 commit into from

Conversation

liudongmiao
Copy link

Nginx handles error_page via ngx_http_internal_redirect, and audit log in ModSecurity-nginx is trigged in the next handler.

In nginx's code, it's harded to GET for non-HEAD, refers https://github.com/nginx/nginx/blob/master/src/http/ngx_http_special_response.c#L618-L621:

        if (r->method != NGX_HTTP_HEAD) {
            r->method = NGX_HTTP_GET;
            r->method_name = ngx_http_core_get_method;
        }

This patch use method_name from request_line to fix this issue.

This should fix method name in #182, and solve #258.

Copy link
Author

@liudongmiao liudongmiao left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't assume method name is always uppercase

Nginx handles `error_page` via `ngx_http_internal_redirect`, and audit log in `ModSecurity-nginx` is trigged in the next handler.

In nginx's code, it's harded to `GET` for non-`HEAD`, refers https://github.com/nginx/nginx/blob/master/src/http/ngx_http_special_response.c#L618-L621:

```c
        if (r->method != NGX_HTTP_HEAD) {
            r->method = NGX_HTTP_GET;
            r->method_name = ngx_http_core_get_method;
        }
```

This patch use `method_name` from `request_line` to fix this issue.

This should fix method name in owasp-modsecurity#182, and solve owasp-modsecurity#258.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant