Buckets:
AnonymousSpottedToad/candidate_bucket / codebase /python /Kolerr-Lab_supper-decoyable /tests /test_django_autofix.py
| # Test file for v1.1.1 auto-fix features | |
| # Django app with SQL injection vulnerabilities | |
| from django.http import HttpResponse | |
| from django.db import connection | |
| def get_user_view(request, user_id): | |
| """SQL Injection via % formatting""" | |
| query = "SELECT * FROM users WHERE id = %s" % user_id | |
| cursor = connection.cursor() | |
| cursor.execute(query) | |
| return HttpResponse("User data") | |
| def search_products(request): | |
| """SQL Injection via string concatenation""" | |
| term = request.GET.get('q', '') | |
| query = "SELECT * FROM products WHERE name = '" + term + "'" | |
| cursor = connection.cursor() | |
| cursor.execute(query) | |
| return HttpResponse("Search results") | |
| def delete_user(request): | |
| """SQL Injection with DELETE statement""" | |
| user_id = request.GET.get('id') | |
| query = "DELETE FROM users WHERE id = %s" % user_id | |
| cursor = connection.cursor() | |
| cursor.execute(query) | |
| return HttpResponse("User deleted") | |
Xet Storage Details
- Size:
- 939 Bytes
- Xet hash:
- de63cffb27ea83ef2b7d73672893f5386d41e014de0d1de8e9822a6455ef1d47
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.