Spaces:
Runtime error
Runtime error
Create utils/code_analysis.py
Browse files- utils/code_analysis.py +9 -0
utils/code_analysis.py
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
def analyze_code(code):
|
| 2 |
+
findings = []
|
| 3 |
+
if "eval(" in code:
|
| 4 |
+
findings.append("⚠️ Usage of eval() – can lead to code injection.")
|
| 5 |
+
if "exec(" in code:
|
| 6 |
+
findings.append("⚠️ Usage of exec() – dangerous if input is not sanitized.")
|
| 7 |
+
if "password" in code:
|
| 8 |
+
findings.append("🔑 Found possible hardcoded password or credentials.")
|
| 9 |
+
return "\n".join(findings) or "✅ No critical issues found."
|