test(path-safety): cover NTFS parent stream traversal

This commit is contained in:
JPPhoto
2026-09-23 20:54:09 -05:00
parent 149daaecc2
commit 38953942ef
3 changed files with 13 additions and 1 deletions
@@ -25,6 +25,7 @@ TRAVERSAL_KEYS = [
"/etc/passwd",
"..\\escaped",
"C:\\Windows\\win",
"..:stream",
"nul\x00byte",
]
@@ -13,7 +13,16 @@ from pydantic import ValidationError
from invokeai.app.services.model_records.model_records_base import ModelRecordChanges
from invokeai.backend.model_manager.util.lora_metadata_extractor import _process_preview_image
TRAVERSAL_KEYS = ["../../pwned", "..", "sub/nested", "/etc/pwned", "..\\pwned", "C:\\pwned", "nul\x00byte"]
TRAVERSAL_KEYS = [
"../../pwned",
"..",
"sub/nested",
"/etc/pwned",
"..\\pwned",
"C:\\pwned",
"..:stream",
"nul\x00byte",
]
@pytest.mark.parametrize("key", TRAVERSAL_KEYS)
+2
View File
@@ -23,6 +23,8 @@ UNSAFE_NAMES = [
"C:\\Windows\\win.ini",
"C:relative",
"\\\\?\\C:\\Windows\\win.ini",
# NTFS stream syntax still parses `..` as the parent component.
"..:stream",
"nul\x00byte",
]