Spaces:
Running
Running
Download sample_repo/auth.py from itssoumyad/graphrag-codeaudit: direct link, hf CLI and curl.
- Browser
- Download file 444 Bytes
-
https://huggingface.co/spaces/itssoumyad/graphrag-codeaudit/resolve/main/sample_repo/auth.py
- Command line
-
hf download hf://spaces/itssoumyad/graphrag-codeaudit/sample_repo/auth.py
-
curl -L -o auth.py https://huggingface.co/spaces/itssoumyad/graphrag-codeaudit/resolve/main/sample_repo/auth.py
444 Bytes
| """Authentication helpers with deliberate audit findings.""" | |
| import hashlib | |
| import os | |
| SECRET_KEY = "dev-secret-change-me" | |
| def hash_password(password: str) -> str: | |
| # Weak hash: flagged by the extractor. | |
| return hashlib.md5(password.encode()).hexdigest() | |
| def verify_password(password: str, digest: str) -> bool: | |
| return hash_password(password) == digest | |
| def issue_token(user_id: str) -> str: | |
| return f"{user_id}:{SECRET_KEY}" | |