Skip to content

Commit

Permalink
🐛 Fixed some bugs.
Browse files Browse the repository at this point in the history
* Built-in variable name error.

* Error in value of built-in variable.

* Superfluous inspection.

* Completely resolve compatibility issues with the ngx_http_rewrite_module.
  • Loading branch information
ADD-SP committed Mar 21, 2021
1 parent ada7c29 commit 2f1c049
Show file tree
Hide file tree
Showing 25 changed files with 532 additions and 206 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ inc/uthash
.vscode
node_modules
docs/.vuepress/dist
yarn.lock
yarn.lock
package-lock.json
24 changes: 23 additions & 1 deletion CHANGES-ZH-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,18 @@

## [未发布]

### 新增

### 移除

### 变动

### 修复

***

## [4.0.0] - 2021-03-22 GMT+0800

### **警告**

**此版本包含不兼容的更新(breaking changes)。**
Expand All @@ -10,12 +22,22 @@

*`waf_mode``waf_cc_deny_limit` 增加了一些参数([368db2b](https://github.com/ADD-SP/ngx_waf/commit/368db2b26e9d2a910c06e77f892740cefe9556d3))。

### 改动
### 移除

* 废弃配置项 `waf_mult_mount`,该配置的功能已经合并到了配置项 `waf_mode` 中。

### 变动

*`waf_mode` 增加了一些参数。

### 修复

* 更正了内置变量 `waf_rule_details` 的名称错误,该变量的名称在之前的版本代码中被设置为 `waf_rule_deatails`

* 不再进行冗余的检测。

* 彻底解决了与 `ngx_http_rewrite_module` 的兼容性问题。

***

## [3.1.6] - 2021-03-07
Expand Down
25 changes: 24 additions & 1 deletion CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,18 @@

## [Unreleased]

### Added

### Removed

### Changed

### Fixed

***

## [4.0.0] - 2021-03-22 GMT+0800

### **WARNING**

**This version contains breaking changes.**
Expand All @@ -10,12 +22,23 @@

* Added some parameters to `waf_mode` and `waf_cc_deny_limit` ([368db2b](https://github.com/ADD-SP/ngx_waf/commit/368db2b26e9d2a910c06e77f892740cefe9556d3)).

### Changed
### Removed

* Abort instruction: `waf_mult_mount`. The function of this directive has been merged into the directive `waf_mode`.

### Changed

* Adds some parameters to the directive `waf_mode`.

### Fixed

* Fixed an error in the name of the built-in variable `waf_rule_details`,
which was set to `waf_rule_deatails` in a previous version of the code.

* No more superfluous inspections.

* Completely resolve compatibility issues with the `ngx_http_rewrite_module`.

***

## [3.1.6] - 2021-03-07
Expand Down
112 changes: 77 additions & 35 deletions config
Original file line number Diff line number Diff line change
@@ -1,13 +1,3 @@
# Check if the uthash library is installed.
ngx_feature="uthash library"
ngx_feature_name=
ngx_feature_run=no
ngx_feature_incs="#include <uthash.h>"
ngx_feature_libs=
ngx_feature_test=
. auto/feature


ngx_addon_name=ngx_http_waf_module

deps="$ngx_addon_dir/inc/ngx_http_waf_module_check.h \
Expand All @@ -21,34 +11,86 @@ deps="$ngx_addon_dir/inc/ngx_http_waf_module_check.h \

srcs="$ngx_addon_dir/src/ngx_http_waf_module_core.c"

if [ $ngx_found = yes ]; then
# Clear these variables to avoid affecting the installation of other modules.
ngx_feature=
ngx_feature_name=
ngx_feature_run=
ngx_feature_incs=
ngx_feature_libs=
ngx_feature_test=
if test -n "$ngx_module_link"; then
ngx_module_type=HTTP
ngx_module_name=ngx_http_waf_module
ngx_module_deps=$deps
ngx_module_incs="$ngx_addon_dir/inc"
ngx_module_srcs=$srcs

. auto/module
else
HTTP_MODULES="$HTTP_MODULES ngx_http_waf_module"
HTTP_DEPS-"$HTTP_DEPS $deps"
NGX_ADDON_INCS="$NGX_ADDON_INCS $ngx_addon_dir/inc"
NGX_ADDON_SRCS="$NGX_ADDON_SRCS $srcs"
fi
else
cat << END
# Check if the uthash library is installed.
ngx_feature="uthash library"
ngx_feature_name=
ngx_feature_run=no
ngx_feature_incs="#include <uthash.h>"
ngx_feature_libs=
ngx_feature_test=
. auto/feature
if [ $ngx_found = no ] ; then
cat << END
$0: error: the $ngx_addon_name module requires the $ngx_feature.

Please visit https://docs.addesp.com/ngx_waf/ or https://add-sp.github.io/ngx_waf/ or https://ngx-waf.pages.dev/ .

END
exit 1
exit 1
fi

# Check if the C compiler supports the C99 standard.
ngx_feature="C99 features"
ngx_feature_name=
ngx_feature_run=yes
ngx_feature_incs=
ngx_feature_libs=
ngx_feature_test=$(cat << END

/* Declare variables in loops. */
for(int i = 0; i < 10; i++) {}

int i = 0, j = 0;

/* Short-circuit operation for logical expressions. */
if (i == 0 || !(j = 1)) {}

if (j == 1) { return 1; }

j = 0;

if (i != 0 && !(j = 1)) {}

if (j == 1) { return 1; }

END
)
. auto/feature
if [ $ngx_found = no ] ; then
cat << END
$0: error: the $ngx_addon_name module requires the $ngx_feature, make sure your C compiler supports and enables the C99 standard.

For gcc, you can enable the C99 standard by appending the parameter --with-cc-opt='-std=c99'.

END
exit 1
fi

# Clear these variables to avoid affecting the installation of other modules.
ngx_feature=
ngx_feature_name=
ngx_feature_run=
ngx_feature_incs=
ngx_feature_libs=
ngx_feature_test=


if test -n "$ngx_module_link"; then
ngx_module_type=HTTP
ngx_module_name=$ngx_addon_name
ngx_module_deps=$deps
ngx_module_incs="$ngx_addon_dir/inc"
ngx_module_srcs=$srcs

# Let ngx_http_rewrite_module initialize before this module,
# so that this module can take effect before ngx_http_rewrite_module,
# because the initialization order and the effective order are reversed.
ngx_module_order="ngx_http_rewrite_module ${ngx_addon_name}"

. auto/module
else
HTTP_MODULES="$HTTP_MODULES ${ngx_addon_name}"
HTTP_DEPS-"$HTTP_DEPS $deps"
NGX_ADDON_INCS="$NGX_ADDON_INCS $ngx_addon_dir/inc"
NGX_ADDON_SRCS="$NGX_ADDON_SRCS $srcs"
fi
25 changes: 24 additions & 1 deletion docs/advance/changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,18 @@ lang: en

## [Unreleased]

### Added

### Removed

### Changed

### Fixed

***

## [4.0.0] - 2021-03-22 GMT+0800

### **WARNING**

**This version contains breaking changes.**
Expand All @@ -15,12 +27,23 @@ lang: en

* Added some parameters to `waf_mode` and `waf_cc_deny_limit` ([368db2b](https://github.com/ADD-SP/ngx_waf/commit/368db2b26e9d2a910c06e77f892740cefe9556d3)).

### Changed
### Removed

* Abort instruction: `waf_mult_mount`. The function of this directive has been merged into the directive `waf_mode`.

### Changed

* Adds some parameters to the directive `waf_mode`.

### Fixed

* Fixed an error in the name of the built-in variable `waf_rule_details`,
which was set to `waf_rule_deatails` in a previous version of the code.

* No more superfluous inspections.

* Completely resolve compatibility issues with the `ngx_http_rewrite_module`.

***

## [3.1.6] - 2021-03-07
Expand Down
25 changes: 20 additions & 5 deletions docs/advance/issue.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,27 @@ lang: en

# Known Issues

## Repeat inspection
Bugs that exist in the latest stable release are listed here,
bugs that have been fixed in the latest stable release are not listed here.

## Built-in variable name error

The built-in variable `waf_rule_details` was incorrectly set to `waf_rule_deatails` within the code.

* Severity: Very serious
* Priority: Highest
* Affected nginx version: >= 1.18.0
* Affected version of ngx_waf: 1.0.0 - 3.2.0-beta.1
* Status: Fixed
* Remarks: Fixed in v4.0.0-beta.1

## Superfluous inspection

Sometimes the inspection is repeated several times, which does not cause errors, but wastes time.

* Severity: It will hardly affect the use.
* Severity: It will hardly affect the use
* Priority: Lowest
* Version: nginx-1.18.0 ~ nginx-1.19.6 & ngx_waf-all-version
* Status: Open
* Remark: —
* Affected nginx version: >= nginx-1.18.0
* Affected version of ngx_waf: 1.0.0 - 3.2.0-beta.1
* Status: Fixed
* Remarks: Fixed in v4.0.0-beta.1
Loading

0 comments on commit 2f1c049

Please sign in to comment.