Skip to content

Commit 2557f9d

Browse files
committed
Allow nested paths in fake fs
1 parent 2f41f4a commit 2557f9d

File tree

2 files changed

+11
-13
lines changed

2 files changed

+11
-13
lines changed

canarytokens/models.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -530,7 +530,7 @@ class WindowsFakeFSTokenRequest(TokenRequest):
530530
@validator("windows_fake_fs_root")
531531
def check_process_name(value: str):
532532
_value = value.strip()
533-
invalid_chars = r'[<>:"/\\|?*]'
533+
invalid_chars = r'[<>:"/|?*[\]]'
534534
drive_pattern = r"^[A-Za-z]:[\\/]"
535535

536536
if not re.match(drive_pattern, _value):

tests/integration/test_windows_fake_fs_token.py

+10-12
Original file line numberDiff line numberDiff line change
@@ -95,17 +95,16 @@ def test_windows_fake_fs_token_fires(
9595
[
9696
(
9797
[
98-
r"C:\Testing["
99-
r"C:\Testing<"
100-
r"C:\Testing>"
101-
r"C:\Testing:"
102-
r'C:\Testing"'
103-
r"C:\Testing/"
104-
r"C:\Testing\\"
105-
r"C:\Testing|"
106-
r"C:\Testing?"
107-
r"C:\Testing*"
108-
r"C:\Testing]"
98+
r"C:\Testing[",
99+
r"C:\Testing<",
100+
r"C:\Testing>",
101+
r"C:\Testing:",
102+
r'C:\Testing"',
103+
r"C:\Testing/",
104+
r"C:\Testing|",
105+
r"C:\Testing?",
106+
r"C:\Testing*",
107+
r"C:\Testing]",
109108
],
110109
"windows_fake_fs_root contains invalid Windows Path Characters.",
111110
),
@@ -126,7 +125,6 @@ def test_windows_fake_fs_token_validator(
126125
"""
127126
memo = "Testing"
128127
file_structure = "testing"
129-
130128
for root_dir in directories:
131129
with pytest.raises(ValueError, match=expected_error_message):
132130
WindowsFakeFSTokenRequest(

0 commit comments

Comments
 (0)