拒绝 UI 资源路径反斜杠

阻止浏览器路径归一化导致的资源目录逃逸

当前资源尚未上线,不增加迁移流程
This commit is contained in:
2026-09-01 15:28:44 +08:00
parent 5e30ad8eac
commit 0564121dfc
@@ -20,6 +20,7 @@ pub(super) fn asset_url(path: &str) -> Result<String, String> {
let path = path.trim();
if path.is_empty()
|| path.starts_with('/')
|| path.contains('\\')
|| path.split('/').any(|part| part == "..")
|| path.chars().any(|character| {
character.is_control() || matches!(character, '\'' | '"' | '`' | '(' | ')')