Spaces:
Sleeping
Sleeping
Download tasks/security_bugs/security_bug_2.json from adityanaikhpt/codeareana: direct link, hf CLI and curl.
- Browser
- Download file 693 Bytes
-
https://huggingface.co/spaces/adityanaikhpt/codeareana/resolve/main/tasks/security_bugs/security_bug_2.json
- Command line
-
hf download hf://spaces/adityanaikhpt/codeareana/tasks/security_bugs/security_bug_2.json
-
curl -L -o security_bug_2.json https://huggingface.co/spaces/adityanaikhpt/codeareana/resolve/main/tasks/security_bugs/security_bug_2.json
693 Bytes
| { | |
| "task_id": "security_bugs-2", | |
| "difficulty": "security_bugs", | |
| "description": "Remove the hardcoded secret token and load it from the os.environ dictionary as 'API_TOKEN'.", | |
| "buggy_code": "import os\ndef get_api_token():\n token = \"secret_12345\"\n return token", | |
| "test_code": "\nimport unittest\nimport inspect\nimport os\nclass TestSecurity2(unittest.TestCase):\n def test_normal(self):\n os.environ['API_TOKEN'] = 'my_secure_token'\n self.assertEqual(get_api_token(), 'my_secure_token')\n def test_security(self):\n source = inspect.getsource(get_api_token)\n self.assertNotIn(\"secret_12345\", source)\n", | |
| "optimal_time_seconds": 0.05 | |
| } |