fix(back): 平台订单 store 透传 back 增强校验(拒绝引号/尖括号)

This commit is contained in:
萝卜
2026-03-14 01:22:53 +00:00
parent ca5e8e63e4
commit a286e19e08

View File

@@ -126,7 +126,8 @@ class PlatformOrderController extends Controller
]);
$back = (string) ($data['back'] ?? '');
$safeBack = str_starts_with($back, '/') ? $back : '';
// back 需为站内相对路径,并拒绝引号/尖括号,避免在后续页面以 `{!! !!}` 原样输出时引入 XSS 风险。
$safeBack = (str_starts_with($back, '/') && !preg_match('/["\'<>]/', $back)) ? $back : '';
$redirectUrl = '/admin/platform-orders/' . $order->id;
if ($safeBack !== '') {