Download scripts/scan_release.py from Januka2009/INVESTIGA-ES: direct link, hf CLI and curl.
- Browser
- Download file 1.14 kB
-
https://huggingface.co/datasets/Januka2009/INVESTIGA-ES/resolve/main/scripts/scan_release.py
- Command line
-
hf download hf://datasets/Januka2009/INVESTIGA-ES/scripts/scan_release.py
-
curl -L -o scan_release.py https://huggingface.co/datasets/Januka2009/INVESTIGA-ES/resolve/main/scripts/scan_release.py
1.14 kB
| """Detect obvious credential literals in deliverable text, without printing matches.""" | |
| import re | |
| from common import * | |
| patterns=[r'\bhf_[A-Za-z0-9]{20,}\b',r'\bsk-[A-Za-z0-9_-]{20,}\b',r'\bAKIA[A-Z0-9]{16}\b',r'-----BEGIN (?:RSA |EC |OPENSSH )?PRIVATE KEY-----'] | |
| findings=[];files=0 | |
| for p in ROOT.rglob('*'): | |
| if not p.is_file() or any(x in p.parts for x in ['.git','__pycache__','.pytest_cache']):continue | |
| if p.suffix not in ['.md','.txt','.py','.json','.jsonl','.csv','.yaml','.yml','.tsv','.xml']:continue | |
| files+=1 | |
| try:s=p.read_text() | |
| except UnicodeDecodeError:continue | |
| if any(re.search(pattern,s) for pattern in patterns):findings.append(str(p.relative_to(ROOT))) | |
| dump(ROOT/'reports/release_secret_scan.json',{'passed':not findings,'text_files_scanned':files,'files_with_findings':findings,'scope':'obvious credential literals only; no secret values logged; Git object database and binary payloads excluded, canonical record checks scan all JSON fields separately'}) | |
| assert not findings,'Release scanner detected credential-shaped text in files: '+str(findings) | |
| print('Release text scan passed:',files,'files') | |