Skip to content

Commit 54e146d

Browse files
Potential fix for code scanning alert no. 6: Uncontrolled data used in path expression (#39)
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
1 parent 5b81bbd commit 54e146d

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

ml/main.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,9 @@ def process(payload: dict):
3030
minio_object = payload.get("minio_object")
3131
record_id = payload.get("record_id")
3232

33-
ext = minio_object.rsplit(".", 1)[-1]
33+
ext = str(minio_object).rsplit(".", 1)[-1].lower()
34+
if not (1 <= len(ext) <= 10 and ext.isalnum()):
35+
ext = "bin"
3436
with tempfile.NamedTemporaryFile(suffix=f".{ext}", delete=False) as tmp:
3537
tmp_path = tmp.name
3638

0 commit comments

Comments
 (0)