fix: mitigate CVE-2026-42945 by using named captures in rewrite (#5769)

This commit is contained in:
纯白色冰淇淋
2026-05-14 17:19:59 +08:00
committed by GitHub
parent 4322f8a3c1
commit 6834d8b2c7

View File

@@ -12,7 +12,7 @@ location / {
# 本地CookieCloud
location /cookiecloud {
proxy_pass http://backend_api;
rewrite ^.+mock-server/?(.*)$ /$1 break;
rewrite ^.+mock-server/?(?<suffix>.*)$ /$suffix break;
proxy_http_version 1.1;
proxy_buffering off;
proxy_cache off;
@@ -54,7 +54,7 @@ location ~ ^/api/v1/system/(message|progress/) {
# API代理配置
location /api {
proxy_pass http://backend_api;
rewrite ^.+mock-server/?(.*)$ /$1 break;
rewrite ^.+mock-server/?(?<api_path>.*)$ /$api_path break;
proxy_http_version 1.1;
proxy_buffering off;
proxy_cache off;
@@ -104,4 +104,4 @@ location /api/v1/site/icon/ {
# 向后端API转发请求
proxy_pass http://backend_api;
}
}