We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e3abe92 commit 9e28a00Copy full SHA for 9e28a00
1 file changed
agent/src/demo_buggy_code.py
@@ -0,0 +1,32 @@
1
+"""Demo file with intentional issues for self-review to catch."""
2
+
3
+import os
4
+import json
5
6
7
+def fetch_user_data(user_id):
8
+ """Fetch user data from the database."""
9
+ query = f"SELECT * FROM users WHERE id = {user_id}" # SQL injection
10
+ # TODO: actually run the query
11
+ return {"id": user_id, "name": "test"}
12
13
14
+def process_config(path):
15
+ """Load and process configuration file."""
16
+ with open(path) as f:
17
+ data = json.load(f)
18
19
+ token = "ghp_abc123secrettoken456" # Hardcoded secret
20
21
+ return {
22
+ "settings": data,
23
+ "auth": token,
24
+ }
25
26
27
+def divide_scores(scores):
28
+ """Calculate average of scores."""
29
+ total = 0
30
+ for s in scores:
31
+ total += s
32
+ return total / len(scores) # ZeroDivisionError if empty list
0 commit comments