Spaces:
Sleeping
Sleeping
Deploy: tasks/security_bugs/security_bug_1.json
Browse files
tasks/security_bugs/security_bug_1.json
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"task_id": "security_bugs-1",
|
| 3 |
+
"difficulty": "security_bugs",
|
| 4 |
+
"description": "Fix the function to parse JSON safely without using eval().",
|
| 5 |
+
"buggy_code": "import json\ndef parse_user_data(data_string):\n return eval(data_string)",
|
| 6 |
+
"test_code": "\nimport unittest\nimport inspect\nclass TestSecurity1(unittest.TestCase):\n def test_normal(self):\n self.assertEqual(parse_user_data('{\"name\": \"alice\"}'), {\"name\": \"alice\"})\n def test_security(self):\n source = inspect.getsource(parse_user_data)\n self.assertNotIn(\"eval(\", source)\n",
|
| 7 |
+
"optimal_time_seconds": 0.05
|
| 8 |
+
}
|