Spaces:
Running
Running
Download sample_repo/db.py from itssoumyad/graphrag-codeaudit: direct link, hf CLI and curl.
- Browser
- Download file 505 Bytes
-
https://huggingface.co/spaces/itssoumyad/graphrag-codeaudit/resolve/main/sample_repo/db.py
- Command line
-
hf download hf://spaces/itssoumyad/graphrag-codeaudit/sample_repo/db.py
-
curl -L -o db.py https://huggingface.co/spaces/itssoumyad/graphrag-codeaudit/resolve/main/sample_repo/db.py
505 Bytes
| """Database access layer with a deliberate SQL construction issue.""" | |
| import sqlite3 | |
| CONNECTION = sqlite3.connect(":memory:") | |
| def find_user(email: str): | |
| cursor = CONNECTION.cursor() | |
| # SQL built from a string: flagged by the extractor. | |
| cursor.execute(f"SELECT id, email FROM users WHERE email = '{email}'") | |
| return cursor.fetchall() | |
| def save_user(email: str): | |
| cursor = CONNECTION.cursor() | |
| cursor.execute("INSERT INTO users (email) VALUES (?)", (email,)) | |
| CONNECTION.commit() | |