😎

NGINX Riftの検出に対応したnginx-lint v0.11をリリースしました

に公開1

https://depthfirst.com/nginx-rift

が公表されました。

バージョンアップで対応できればそれが一番よいですがすぐにアップグレードが難しい場合設定ファイルをnamed captureにすることで対応できるとされているので私が作っているnginx-lintで検出できるようにしたv0.11.0をリリース しておきました。

今回の問題に迅速に対応するためにnginx-lintを初めて利用する場合に他のルールが検出されると対応が遅れるので、特定のruleだけ実行する--rule-onlyというオプションを追加しておきました。

これを利用すると

nginx-lint --rule-only nginx-rift crates/nginx-lint-parser/tests/fixtures/test_generated/0*
crates/nginx-lint-parser/tests/fixtures/test_generated/0048_regex_rewrite_advanced.conf:35:9: warning[security/nginx-rift]: CVE-2026-42945: `rewrite` replacement contains `?` and is followed by a directive that references an unnamed capture ($1..$9) in the same scope — this triggers a heap buffer overflow on nginx <1.30.1/<1.31.0. Upgrade nginx, switch to named captures, or remove `?` from the replacement.
crates/nginx-lint-parser/tests/fixtures/test_generated/0048_regex_rewrite_advanced.conf:36:9: warning[security/nginx-rift]: CVE-2026-42945: `rewrite` replacement contains `?` and is followed by a directive that references an unnamed capture ($1..$9) in the same scope — this triggers a heap buffer overflow on nginx <1.30.1/<1.31.0. Upgrade nginx, switch to named captures, or remove `?` from the replacement.
...

のようにnginx-lintでnginx設定ファイル内でこのパターンが含まれているかどうかのチェックだけをすることができるのでぜひお試しあれ。

ただうまく動くためにはincludeをたどって読めるようにする必要があるので、include-pathなどの設定の調整は必要かもしれません。

autofixも対応できればうれしい人もいるだろうとは思いつつ、けっこう正規表現のパターンをうまく対応するのは複雑なのでひとまずは検出の対応だけ対応をしました。

Discussion