fix(ai): broaden SSRF pre-scan regex to cover srcset, poster, formaction, @import

This commit is contained in:
SnapOtter
2026-06-13 10:36:12 +08:00
parent fc718c1684
commit 5397f9b21c
2 changed files with 26 additions and 2 deletions
+2 -2
View File
@@ -10,11 +10,11 @@ import re
import sys
_REMOTE_REF_RE = re.compile(
r'(?:src|href|action)\s*=\s*["\']?\s*(https?:/{1,2}[^\s"\'>\)]{1,200})',
r'(?:src|href|action|srcset|poster|formaction)\s*=\s*["\']?\s*(https?:/{1,2}[^\s"\'>\)]{1,200})',
re.IGNORECASE,
)
_REMOTE_CSS_URL_RE = re.compile(
r'url\s*\(\s*["\']?\s*(https?:/{1,2}[^\s"\'>\)]{1,200})',
r'(?:url\s*\(|@import)\s*["\']?\s*(https?:/{1,2}[^\s"\'>\)]{1,200})',
re.IGNORECASE,
)