拒绝 UI 资源路径反斜杠
阻止浏览器路径归一化导致的资源目录逃逸 当前资源尚未上线,不增加迁移流程
This commit is contained in:
@@ -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, '\'' | '"' | '`' | '(' | ')')
|
||||
|
||||
Reference in New Issue
Block a user