[GH-ISSUE #94] waf_rule_path in http context works improperly #207

Closed
opened 2026-03-13 17:02:46 +03:00 by kerem · 6 comments
Owner

Originally created by @ononoki1 on GitHub (May 9, 2022).
Original GitHub issue: https://github.com/ADD-SP/ngx_waf/issues/94

Problem

The following config will not work:

http {
  waf_rule_path /path/to/rule/;
  server {
    waf on;
  }
}

While the following one works:

http {
  server {
    waf on;
    waf_rule_path /path/to/rule/;
  }
}

And this one also works:

http {
  waf on;
  waf_rule_path /path/to/rule/;
  server {
  }
}

Technically, NGINX's current context's config should inherit its parent's one, which is not the case in this particular circumstance. I think this should be a bug instead of a feature.

Originally created by @ononoki1 on GitHub (May 9, 2022). Original GitHub issue: https://github.com/ADD-SP/ngx_waf/issues/94 ## Problem The following config will not work: ```txt http { waf_rule_path /path/to/rule/; server { waf on; } } ``` While the following one works: ```txt http { server { waf on; waf_rule_path /path/to/rule/; } } ``` And this one also works: ```txt http { waf on; waf_rule_path /path/to/rule/; server { } } ``` Technically, NGINX's current context's config should inherit its parent's one, which is not the case in this particular circumstance. I think this should be a bug instead of a feature.
kerem 2026-03-13 17:02:46 +03:00
Author
Owner

@ononoki1 commented on GitHub (May 9, 2022):

The ngx_waf version is latest current branch.

<!-- gh-comment-id:1121341351 --> @ononoki1 commented on GitHub (May 9, 2022): The ngx_waf version is latest current branch.
Author
Owner

@stale[bot] commented on GitHub (May 18, 2022):

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
此 issue 因为最近没有任何活动已经被标记,如果在此之后的一段时间内仍没有任何活动则会被关闭。感谢您对项目的支持。

<!-- gh-comment-id:1129485090 --> @stale[bot] commented on GitHub (May 18, 2022): This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. 此 issue 因为最近没有任何活动已经被标记,如果在此之后的一段时间内仍没有任何活动则会被关闭。感谢您对项目的支持。
Author
Owner

@ononoki1 commented on GitHub (May 18, 2022):

What can I do to help investigate this issue?

<!-- gh-comment-id:1129535743 --> @ononoki1 commented on GitHub (May 18, 2022): What can I do to help investigate this issue?
Author
Owner
<!-- gh-comment-id:1133880645 --> @ADD-SP commented on GitHub (May 22, 2022): There may be some bugs here, I'm not sure. https://github.com/ADD-SP/ngx_waf/blob/107cca9dec00edf97a9cd9f18cca465284e044bc/src/ngx_http_waf_module_config.c#L1761-L1774 https://github.com/ADD-SP/ngx_waf/blob/107cca9dec00edf97a9cd9f18cca465284e044bc/src/ngx_http_waf_module_config.c#L187-L203
Author
Owner

@stale[bot] commented on GitHub (May 29, 2022):

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
此 issue 因为最近没有任何活动已经被标记,如果在此之后的一段时间内仍没有任何活动则会被关闭。感谢您对项目的支持。

<!-- gh-comment-id:1140442058 --> @stale[bot] commented on GitHub (May 29, 2022): This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. 此 issue 因为最近没有任何活动已经被标记,如果在此之后的一段时间内仍没有任何活动则会被关闭。感谢您对项目的支持。
Author
Owner

@ononoki1 commented on GitHub (May 29, 2022):

Since it's not a security bug and has a workaround, I just close it. You can reopen it when having time to solve.

<!-- gh-comment-id:1140445355 --> @ononoki1 commented on GitHub (May 29, 2022): Since it's not a security bug and has a workaround, I just close it. You can reopen it when having time to solve.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/ngx_waf#207
No description provided.