mirror of
https://github.com/NicolasBohn/NexQuant.git
synced 2026-08-05 19:17:43 +00:00
fix: Add Bandit security scanning and fix critical vulnerabilities
- Add Bandit security scanner to requirements and pre-commit hooks - Fix CWE-22 path traversal in tarfile/zipfile extraction (3 files) * Add _safe_extract() validation in submit.py, env.py, kaggle_crawler.py * Prevents malicious archives from writing outside target directory - Fix MD5 hashlib calls with usedforsecurity=False flag (2 files) * submission_format_test.txt files for checksum validation - Configure .bandit.yml for automated security scanning * Skip known false positives: B602 (subprocess), B701 (Jinja2) - Add security runbook documentation in docs/security/ - Add pre-commit hook scripts for automated Bandit scanning All 106 backtesting and security tests pass. Security issues resolved: B201, B202, B324 (9 total fixes)
This commit is contained in:
+1
-1
@@ -5,7 +5,7 @@ import pandas as pd
|
||||
|
||||
def calculate_md5(file_path):
|
||||
with open(file_path, "rb") as f:
|
||||
file_hash = hashlib.md5(f.read()).hexdigest()
|
||||
file_hash = hashlib.md5(f.read(), usedforsecurity=False).hexdigest()
|
||||
return file_hash
|
||||
|
||||
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@ import hashlib
|
||||
|
||||
def calculate_md5(file_path):
|
||||
with open(file_path, "rb") as f:
|
||||
file_hash = hashlib.md5(f.read()).hexdigest()
|
||||
file_hash = hashlib.md5(f.read(), usedforsecurity=False).hexdigest()
|
||||
return file_hash
|
||||
|
||||
file_md5 = calculate_md5("scores.csv")
|
||||
|
||||
Reference in New Issue
Block a user