Skip to content

Commit dcb6ffe

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent 0ef4891 commit dcb6ffe

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

bandit/plugins/huggingface_unsafe_download.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464
@test.test_id("B615")
6565
def huggingface_unsafe_download(context):
6666
"""
67-
This plugin checks for unsafe artifact download from Hugging Face Hub
67+
This plugin checks for unsafe artifact download from Hugging Face Hub
6868
without immutable/reproducible revision pinning.
6969
"""
7070
# Check if any HuggingFace-related modules are imported
@@ -119,11 +119,11 @@ def huggingface_unsafe_download(context):
119119
# Commit hashes: 40 chars (full SHA) or 7+ chars (short SHA)
120120
if isinstance(revision_to_check, str):
121121
# Remove quotes if present
122-
revision_str = str(revision_to_check).strip('"\'')
122+
revision_str = str(revision_to_check).strip("\"'")
123123

124124
# Check if it looks like a commit hash (hexadecimal string)
125125
# Must be at least 7 characters and all hexadecimal
126-
hex_chars = '0123456789abcdefABCDEF'
126+
hex_chars = "0123456789abcdefABCDEF"
127127
is_hex = all(c in hex_chars for c in revision_str)
128128
if len(revision_str) >= 7 and is_hex:
129129
# This looks like a commit hash, which is secure

0 commit comments

Comments
 (0)