Skip to content

Commit a8fb6be

Browse files
committed
Review comments
1 parent 9a75b85 commit a8fb6be

2 files changed

Lines changed: 6 additions & 4 deletions

File tree

dfetch/manifest/schema.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
NUMBER = Int() | Float()
66

77
# A safe string: no NUL, no control chars
8-
SAFE_STR = Regex(r"^[^\x00]*$")
8+
SAFE_STR = Regex(r"^[^\x00-\x1F\x7F-\x9F]*$")
99

1010
REMOTE_SCHEMA = Map(
1111
{

tests/test_fuzzing.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,10 @@
4141
# Avoid control chars and NUL to prevent OS/path/subprocess issues in tests
4242
SAFE_TEXT = st.text(
4343
alphabet=st.characters(
44-
min_codepoint=32, blacklist_categories=("Cs",)
45-
), # no controls/surrogates
44+
min_codepoint=0x20,
45+
blacklist_characters=[chr(c) for c in range(0x7F, 0xA0)],
46+
blacklist_categories=("Cs",),
47+
),
4648
min_size=0,
4749
max_size=64,
4850
)
@@ -76,7 +78,7 @@ def opt_str():
7678

7779
vcs_enum = st.sampled_from(["git", "svn"])
7880

79-
ignore_list = st.lists(SAFE_TEXT, min_size=1, max_size=5)
81+
ignore_list = st.none() | st.lists(SAFE_TEXT, min_size=1, max_size=5)
8082

8183
project_entry = st.builds(
8284
lambda name, dst, branch, tag, revision, url, repo_path, remote, patch, vcs, src, ignore: {

0 commit comments

Comments
 (0)