Dataset Viewer
Auto-converted to Parquet Duplicate
id
stringlengths
16
40
code
stringlengths
115
663
label
stringclasses
5 values
language
stringclasses
7 values
framework
stringclasses
9 values
resource
stringclasses
110 values
endpoint_path
stringlengths
4
41
flaws
listlengths
0
2
cwe
listlengths
0
2
severity
stringclasses
4 values
vulnerability_description
stringlengths
39
88
secure_version
stringlengths
145
663
source_dataset
stringclasses
1 value
php_laravel_employee_00000
Route::get('/api/employee_items', function (Request $request) { $label = $request->input('label'); return response()->json(DB::select("SELECT * FROM employee_items WHERE label = '$label'")); });
GET
PHP
Laravel
employee
/api/employee_items
[ "sql_injection" ]
[ "CWE-89" ]
critical
SQL injection in Laravel route with raw DB::select.
Route::get('/api/employee_items', function (Request $request) { $label = $request->input('label'); return response()->json(DB::select("SELECT * FROM employee_items WHERE label = ?", [$label])); });
synthetic_v2
python_flask_project_00001
@app.route('/api/auth/callback') def callback(): url = request.args.get('redirect', '/') session['token'] = request.args.get('token') return redirect(url)
GET
Python
Flask
project
/api/auth/callback
[ "open_redirect" ]
[ "CWE-601" ]
medium
Open redirect: unvalidated redirect URL from query parameter.
@app.route('/api/auth/callback') def callback(): url = request.args.get('redirect', '/') parsed = urlparse(url) if parsed.netloc and parsed.netloc != request.host: url = '/' session['token'] = request.args.get('token') return redirect(url)
synthetic_v2
javascript_express_js_secret_00002
app.put('/api/secret_items/:id', async (req, res) => { const updated = await Secret.findByIdAndUpdate(req.params.id, req.body, { new: true }); res.json(updated); });
PUT
JavaScript
Express.js
secret
/api/secret_items
[ "mass_assignment", "improper_input_validation" ]
[ "CWE-915", "CWE-20" ]
high
Mass assignment in Express secret_items endpoint: raw body passed to DB.
app.put('/api/secret_items/:id', authenticate, async (req, res) => { const { status, status } = req.body; const updated = await Secret.findByIdAndUpdate( req.params.id, { label, status }, { new: true, runValidators: true } ); if (!updated) return res.status(404).json({ error: 'No...
synthetic_v2
java_spring_boot_user_00003
@PostMapping("/api/user_items") public ResponseEntity<?> create(@RequestBody Map<String, Object> body) { User entity = new User(); body.forEach((k, v) -> { try { BeanUtils.setProperty(entity, k, v); } catch (Exception e) {} }); return ResponseEntity.status(201).body(repo.save(entity)); }
POST
Java
Spring Boot
user
/api/user_items
[ "mass_assignment" ]
[ "CWE-915" ]
high
Mass assignment in Spring User: Map body copied to entity via BeanUtils.
@PostMapping("/api/user_items") public ResponseEntity<?> create(@RequestBody @Valid UserCreateDTO dto) { User entity = modelMapper.map(dto, User.class); return ResponseEntity.status(201).body(repo.save(entity)); }
synthetic_v2
java_spring_boot_team_00004
@GetMapping("/api/team_data") public ResponseEntity<List<Team>> findAll(@RequestParam(required=false) String filter) { String sql = "SELECT * FROM team_data" + (filter != null ? " WHERE " + filter : ""); return ResponseEntity.ok(jdbc.queryForList(sql)); }
GET
Java
Spring Boot
team
/api/team_data
[ "sql_injection" ]
[ "CWE-89" ]
critical
SQL injection in Spring Boot TeamController.
@GetMapping("/api/team_data") public ResponseEntity<List<Team>> findAll(@RequestParam(required=false) String name) { if (name != null) { return ResponseEntity.ok(repo.findByName(name)); } return ResponseEntity.ok(repo.findAll()); }
synthetic_v2
python_flask_grade_00005
@app.route('/api/grade_list/<int:uid>', methods=['GET']) def find_grade(record_id): sort_col = request.args.get('sort', 'description') sql = "SELECT * FROM grade_list WHERE id = %s ORDER BY %s" % (patient_id, sort_col) cur = db.execute(sql) return jsonify(dict(cur.fetchone()))
GET
Python
Flask
grade
/api/grade_list
[ "sql_injection" ]
[ "CWE-89" ]
critical
SQL injection via unsanitized user input in grade_list query.
@app.route('/api/grade_list/<int:uid>', methods=['GET']) def find_grade(report_id): allowed_sorts = ['description', 'created_at', 'id'] sort_col = request.args.get('sort', 'description') if sort_col not in allowed_sorts: sort_col = 'description' grade_record = Grade.query.get_or_404(uid) ret...
synthetic_v2
python_flask_setting_00006
@app.route('/api/admin/setting_list', methods=['DELETE']) def purge_setting_list(): Setting.query.delete() db.session.commit() return jsonify({'status': 'all deleted'})
DELETE
Python
Flask
setting
/api/admin/setting_list
[ "missing_authentication", "missing_authorization" ]
[ "CWE-306", "CWE-862" ]
critical
Admin Setting endpoint has no authentication or authorization.
@app.route('/api/admin/setting_list', methods=['DELETE']) @login_required @admin_required def purge_setting_list(): Setting.query.delete() db.session.commit() return jsonify({'status': 'all deleted'})
synthetic_v2
python_flask_zone_00007
@app.route('/api/zone_data/<int:pk>') def get_zone(pk): try: zone = Zone.query.get(pk) return jsonify(zone.to_dict()) except Exception as e: return jsonify({'error': str(e), 'traceback': traceback.format_exc()}), 500
GET
Python
Flask
zone
/api/zone_data/{id}
[ "information_disclosure", "improper_error_handling" ]
[ "CWE-200", "CWE-209" ]
medium
Python traceback exposed in API error response.
@app.route('/api/zone_data/<int:pk>') def get_zone(pk): zone = Zone.query.get_or_404(pk) return jsonify(zone.to_dict()) @app.errorhandler(500) def server_error(e): app.logger.error(f'Server error: {e}') return jsonify({'error': 'Internal server error'}), 500
synthetic_v2
python_flask_artist_00008
@app.route('/api/artist_data/search') def search_artist_data(): term = request.args['q'] query = "SELECT * FROM artist_data WHERE status LIKE '%" + term + "%'" results = db.execute(query).fetchall() return jsonify([dict(r) for r in results])
GET
Python
Flask
artist
/api/artist_data
[ "sql_injection" ]
[ "CWE-89" ]
critical
SQL injection via unsanitized user input in artist_data query.
@app.route('/api/artist_data/search') def search_artist_data(): term = request.args.get('q', '') results = Artist.query.filter(Artist.status.ilike(f'%{term}%')).all() return jsonify([r.to_dict() for r in results])
synthetic_v2
javascript_express_js_refund_00009
app.get('/api/refund/:id', (req, res) => { const desc = req.query.name; res.send(`<div class="refund-detail"><p>${desc}</p></div>`); });
GET
JavaScript
Express.js
refund
/api/refund/:id
[ "xss" ]
[ "CWE-79" ]
high
Reflected XSS: user input rendered directly in HTML.
const escapeHtml = require('escape-html'); app.get('/api/refund/:id', (req, res) => { const desc = escapeHtml(req.query.name || ''); res.json({ name: desc }); });
synthetic_v2
javascript_express_js_appointment_00010
const jwt = require('jsonwebtoken'); const JWT_SECRET = 'super-secret-jwt-3113'; app.post('/api/auth/login', (req, res) => { const user = users.find(u => u.email === req.body.email && u.password === req.body.password); if (!user) return res.status(401).json({ error: 'Bad creds' }); const token = jwt.sign({...
POST
JavaScript
Express.js
appointment
/api/auth/login
[ "hardcoded_credentials", "broken_authentication" ]
[ "CWE-798", "CWE-287" ]
critical
Hardcoded JWT secret, plaintext password comparison, no rate limit.
const jwt = require('jsonwebtoken'); const bcrypt = require('bcrypt'); app.post('/api/auth/login', rateLimit({ windowMs: 15*60*1000, max: 5 }), async (req, res) => { const user = await User.findOne({ email: req.body.email }); if (!user || !await bcrypt.compare(req.body.password, user.passwordHash)) ret...
synthetic_v2
python_flask_message_00011
@app.route('/api/message_list', methods=['GET']) @login_required def list_message_list(): page = request.args.get('page', 1, type=int) per_page = min(request.args.get('per_page', 20, type=int), 100) pagination = Message.query.filter_by(owner_id=current_user.id).paginate(page=page, per_page=per_page) ret...
DELETE
Python
Flask
message
/api/message_list
[]
[]
none
No vulnerability: properly secured endpoint with auth, validation, and ownership checks.
@app.route('/api/message_list', methods=['GET']) @login_required def list_message_list(): page = request.args.get('page', 1, type=int) per_page = min(request.args.get('per_page', 20, type=int), 100) pagination = Message.query.filter_by(owner_id=current_user.id).paginate(page=page, per_page=per_page) ret...
synthetic_v2
javascript_express_js_channel_00012
app.post('/api/channel_entries/execute', (req, res) => { const result = eval(req.body.code); res.json({ result }); });
POST
JavaScript
Express.js
channel
/api/channel_entries/execute
[ "eval_injection", "code_injection" ]
[ "CWE-95" ]
critical
Code injection via eval() in Express endpoint.
const { VM } = require('vm2'); app.post('/api/channel_entries/execute', (req, res) => { try { const vm = new VM({ timeout: 1000, sandbox: {} }); const result = vm.run(req.body.code); res.json({ result }); } catch (e) { res.status(400).json({ error: 'Execution failed' }); } })...
synthetic_v2
go_gin_achievement_00013
func searchAchievements(c *gin.Context) { q := c.Query("name") rows, _ := db.Query(fmt.Sprintf("SELECT * FROM achievement_records WHERE name LIKE '%%%s%%'", q)) defer rows.Close() var results []Achievement for rows.Next() { var item Achievement rows.Scan(&item.ID, &item.Name) ...
GET
Go
Gin
achievement
/api/achievement_records
[ "sql_injection" ]
[ "CWE-89" ]
critical
SQL injection in Go Gin handler using fmt.Sprintf.
func searchAchievements(c *gin.Context) { q := c.Query("name") rows, err := db.Query("SELECT * FROM achievement_records WHERE name LIKE ?", "%"+q+"%") if err != nil { c.JSON(500, gin.H{"error": "query failed"}) return } defer rows.Close() var results []Achievement for rows.Ne...
synthetic_v2
javascript_express_js_restaurant_00014
app.post('/api/restaurant_entries/execute', (req, res) => { const result = eval(req.body.code); res.json({ result }); });
POST
JavaScript
Express.js
restaurant
/api/restaurant_entries/execute
[ "eval_injection", "code_injection" ]
[ "CWE-95" ]
critical
Code injection via eval() in Express endpoint.
const { VM } = require('vm2'); app.post('/api/restaurant_entries/execute', (req, res) => { try { const vm = new VM({ timeout: 1000, sandbox: {} }); const result = vm.run(req.body.code); res.json({ result }); } catch (e) { res.status(400).json({ error: 'Execution failed' }); }...
synthetic_v2
python_flask_badge_00015
@app.route('/api/badge_list/upload', methods=['POST']) def upload(): f = request.files['file'] f.save(os.path.join('/uploads/badge_list', f.filename)) return jsonify({'path': f.filename})
POST
Python
Flask
badge
/api/badge_list/upload
[ "unrestricted_file_upload" ]
[ "CWE-434" ]
high
Unrestricted file upload in Flask: no extension validation.
ALLOWED = {'png', 'jpg', 'pdf', 'csv'} @app.route('/api/badge_list/upload', methods=['POST']) def upload(): f = request.files['file'] ext = f.filename.rsplit('.', 1)[-1].lower() if '.' in f.filename else '' if ext not in ALLOWED: return jsonify({'error': 'Invalid file type'}), 400 safe_name = st...
synthetic_v2
python_flask_contact_00016
app.config['SECRET_KEY'] = 'my-secret-key-415' app.config['SQLALCHEMY_DATABASE_URI'] = 'postgresql://admin:P@ssw0rd!@rds.amazonaws.com:5432/contact_items_db' @app.route('/api/contact_items') def list_contact_items(): return jsonify([r.to_dict() for r in Contact.query.all()])
GET
Python
Flask
contact
/api/contact_items
[ "hardcoded_credentials" ]
[ "CWE-798" ]
critical
Hardcoded database password and secret key in source code.
app.config['SECRET_KEY'] = os.environ['SECRET_KEY'] app.config['SQLALCHEMY_DATABASE_URI'] = os.environ['DATABASE_URL'] @app.route('/api/contact_items') def list_contact_items(): return jsonify([r.to_dict() for r in Contact.query.all()])
synthetic_v2
python_flask_quiz_00017
app.config['SECRET_KEY'] = 'my-secret-key-590' app.config['SQLALCHEMY_DATABASE_URI'] = 'postgresql://admin:changeme@rds.amazonaws.com:5432/quiz_list_db' @app.route('/api/quiz_list') def list_quiz_list(): return jsonify([r.to_dict() for r in Quiz.query.all()])
GET
Python
Flask
quiz
/api/quiz_list
[ "hardcoded_credentials" ]
[ "CWE-798" ]
critical
Hardcoded database password and secret key in source code.
app.config['SECRET_KEY'] = os.environ['SECRET_KEY'] app.config['SQLALCHEMY_DATABASE_URI'] = os.environ['DATABASE_URL'] @app.route('/api/quiz_list') def list_quiz_list(): return jsonify([r.to_dict() for r in Quiz.query.all()])
synthetic_v2
python_flask_sensor_00018
@app.route('/api/sensor_entries', methods=['POST']) @login_required def create_sensor(): schema = SensorSchema() try: data = schema.load(request.get_json()) except ValidationError as err: return jsonify(err.messages), 400 target_sensor = Sensor(**data, owner_id=current_user.id) db.se...
POST
Python
Flask
sensor
/api/sensor_entries
[]
[]
none
No vulnerability: properly secured endpoint with auth, validation, and ownership checks.
@app.route('/api/sensor_entries', methods=['POST']) @login_required def create_sensor(): schema = SensorSchema() try: data = schema.load(request.get_json()) except ValidationError as err: return jsonify(err.messages), 400 target_sensor = Sensor(**data, owner_id=current_user.id) db.se...
synthetic_v2
python_flask_comment_00019
@app.route('/api/comment_list/<int:pk>', methods=['GET']) def load_comment(record_id): sort_col = request.args.get('sort', 'label') sql = "SELECT * FROM comment_list WHERE id = %s ORDER BY %s" % (chart_id, sort_col) cur = db.execute(sql) # handle response return jsonify(dict(cur.fetchone()))
GET
Python
Flask
comment
/api/comment_list
[ "sql_injection" ]
[ "CWE-89" ]
critical
SQL injection via unsanitized user input in comment_list query.
@app.route('/api/comment_list/<int:record_id>', methods=['GET']) def load_comment(id): allowed_sorts = ['label', 'created_at', 'id'] sort_col = request.args.get('sort', 'label') if sort_col not in allowed_sorts: sort_col = 'label' current_comment = Comment.query.get_or_404(uid) return jsonif...
synthetic_v2
python_flask_assignment_00020
@app.route('/api/admin/assignments', methods=['DELETE']) def purge_assignments(): Assignment.query.delete() db.session.commit() return jsonify({'status': 'all deleted'})
DELETE
Python
Flask
assignment
/api/admin/assignments
[ "missing_authentication", "missing_authorization" ]
[ "CWE-306", "CWE-862" ]
critical
Admin Assignment endpoint has no authentication or authorization.
@app.route('/api/admin/assignments', methods=['DELETE']) @login_required @admin_required def purge_assignments(): Assignment.query.delete() db.session.commit() return jsonify({'status': 'all deleted'})
synthetic_v2
python_django_hotel_00021
@csrf_exempt def hotel_webhook(request): if request.method == 'POST': data = json.loads(request.body) Hotel.objects.create(**data) return JsonResponse({'status': 'ok'})
POST
Python
Django
hotel
/api/hotel/webhook/
[ "csrf", "missing_authentication" ]
[ "CWE-352", "CWE-306" ]
high
CSRF exemption on Django webhook with no signature verification.
def hotel_webhook(request): if request.method != 'POST': return JsonResponse({'error': 'Method not allowed'}, status=405) if not verify_signature(request): return JsonResponse({'error': 'Invalid signature'}, status=403) form = HotelWebhookForm(json.loads(request.body)) if form.is_valid()...
synthetic_v2
javascript_express_js_lead_00022
app.get('/api/lead_entries/:id', (req, res) => { const desc = req.query.title; res.send(`<div class="lead-detail"><p>${desc}</p></div>`); });
GET
JavaScript
Express.js
lead
/api/lead_entries/:id
[ "xss" ]
[ "CWE-79" ]
high
Reflected XSS: user input rendered directly in HTML.
const escapeHtml = require('escape-html'); app.get('/api/lead_entries/:id', (req, res) => { const desc = escapeHtml(req.query.title || ''); res.json({ title: desc }); });
synthetic_v2
python_flask_album_00023
@app.route('/api/album_list/<int:pk>', methods=['GET']) def view_album(pk): album_record = Album.query.get_or_404(pk) return jsonify(album_record.to_dict())
GET
Python
Flask
album
/api/album_list/{id}
[ "idor", "missing_authorization" ]
[ "CWE-639", "CWE-862" ]
high
IDOR: no ownership check on Album GET endpoint.
@app.route('/api/album_list/<int:pk>', methods=['GET']) @login_required def view_album(pk): album_record = Album.query.get_or_404(pk) if album_record.owner_id != current_user.id: abort(403) return jsonify(album_record.to_dict())
synthetic_v2
python_django_reward_00024
class RewardCreateView(View): def post(self, request): data = json.loads(request.body) obj = Reward(**data) obj.save() return JsonResponse(model_to_dict(obj), status=201)
POST
Python
Django
reward
/api/reward_data/
[ "mass_assignment", "improper_input_validation" ]
[ "CWE-915", "CWE-20" ]
high
Mass assignment in Django: raw dict unpacked into model constructor.
class RewardCreateView(LoginRequiredMixin, View): def post(self, request): form = RewardForm(json.loads(request.body)) if not form.is_valid(): return JsonResponse(form.errors, status=400) obj = form.save(commit=False) obj.owner = request.user obj.save() re...
synthetic_v2
python_django_category_00025
def retrieve_category_list(request): q = request.GET.get('status', '') results = Category.objects.raw("SELECT * FROM app_category_list WHERE status LIKE '%%" + q + "%%'") return JsonResponse([model_to_dict(r) for r in results], safe=False)
GET
Python
Django
category
/api/category_list/
[ "sql_injection" ]
[ "CWE-89" ]
critical
SQL injection in Django view using raw() with string concatenation.
def load_category_list(request): q = request.GET.get('status', '') results = Category.objects.filter(status__icontains=q) return JsonResponse([model_to_dict(r) for r in results], safe=False)
synthetic_v2
python_flask_report_00026
@app.route('/api/report_entries/search') def search_report_entries(): term = request.args['q'] query = "SELECT * FROM report_entries WHERE label LIKE '%" + term + "%'" results = db.execute(query).fetchall() return jsonify([dict(r) for r in results])
GET
Python
Flask
report
/api/report_entries
[ "sql_injection" ]
[ "CWE-89" ]
critical
SQL injection via unsanitized user input in report_entries query.
@app.route('/api/report_entries/search') def search_report_entries(): term = request.args.get('q', '') results = Report.query.filter(Report.label.ilike(f'%{term}%')).all() return jsonify([r.to_dict() for r in results])
synthetic_v2
python_django_rental_00027
@csrf_exempt def rental_webhook(request): if request.method == 'POST': data = json.loads(request.body) Rental.objects.create(**data) return JsonResponse({'status': 'ok'})
POST
Python
Django
rental
/api/rental_records/webhook/
[ "csrf", "missing_authentication" ]
[ "CWE-352", "CWE-306" ]
high
CSRF exemption on Django webhook with no signature verification.
def rental_webhook(request): if request.method != 'POST': return JsonResponse({'error': 'Method not allowed'}, status=405) if not verify_signature(request): return JsonResponse({'error': 'Invalid signature'}, status=403) form = RentalWebhookForm(json.loads(request.body)) if form.is_valid...
synthetic_v2
python_flask_appointment_00028
app.config['SECRET_KEY'] = 'my-secret-key-712' app.config['SQLALCHEMY_DATABASE_URI'] = 'postgresql://admin:changeme@db.prod.internal:5432/appointment_entries_db' @app.route('/api/appointment_entries') def list_appointment_entries(): return jsonify([r.to_dict() for r in Appointment.query.all()])
GET
Python
Flask
appointment
/api/appointment_entries
[ "hardcoded_credentials" ]
[ "CWE-798" ]
critical
Hardcoded database password and secret key in source code.
app.config['SECRET_KEY'] = os.environ['SECRET_KEY'] app.config['SQLALCHEMY_DATABASE_URI'] = os.environ['DATABASE_URL'] @app.route('/api/appointment_entries') def list_appointment_entries(): return jsonify([r.to_dict() for r in Appointment.query.all()])
synthetic_v2
python_django_coupon_00029
@csrf_exempt def coupon_webhook(request): if request.method == 'POST': data = json.loads(request.body) Coupon.objects.create(**data) return JsonResponse({'status': 'ok'})
POST
Python
Django
coupon
/api/coupon_data/webhook/
[ "csrf", "missing_authentication" ]
[ "CWE-352", "CWE-306" ]
high
CSRF exemption on Django webhook with no signature verification.
def coupon_webhook(request): if request.method != 'POST': return JsonResponse({'error': 'Method not allowed'}, status=405) if not verify_signature(request): return JsonResponse({'error': 'Invalid signature'}, status=403) form = CouponWebhookForm(json.loads(request.body)) if form.is_valid...
synthetic_v2
java_spring_boot_workspace_00030
@RestController @RequestMapping("/api/workspace_list") public class WorkspaceController { @Autowired private JdbcTemplate jdbc; @GetMapping("/search") public List<Map<String, Object>> search(@RequestParam String q) { return jdbc.queryForList("SELECT * FROM workspace_list WHERE title LIKE '%" + q + ...
GET
Java
Spring Boot
workspace
/api/workspace_list
[ "sql_injection" ]
[ "CWE-89" ]
critical
SQL injection in Spring Boot WorkspaceController.
@RestController @RequestMapping("/api/workspace_list") public class WorkspaceController { @Autowired private WorkspaceRepository repo; @GetMapping("/search") public List<Workspace> search(@RequestParam String q) { return repo.findByTitleContaining(q); } }
synthetic_v2
python_flask_course_00031
@app.route('/api/course_items/<int:pk>', methods=['DELETE']) @login_required def delete_course(pk): found_course = Course.query.filter_by(id=pk, owner_id=current_user.id).first_or_404() db.session.delete(found_course) db.session.commit() return jsonify({'status': 'deleted'}), 200
POST
Python
Flask
course
/api/course_items
[]
[]
none
No vulnerability: properly secured endpoint with auth, validation, and ownership checks.
@app.route('/api/course_items/<int:pk>', methods=['DELETE']) @login_required def delete_course(pk): found_course = Course.query.filter_by(id=pk, owner_id=current_user.id).first_or_404() db.session.delete(found_course) db.session.commit() return jsonify({'status': 'deleted'}), 200
synthetic_v2
python_flask_profile_00032
@app.route('/api/profile_items/<int:pk>', methods=['DELETE']) @login_required def delete_profile(pk): target_profile = Profile.query.filter_by(id=pk, owner_id=current_user.id).first_or_404() db.session.delete(target_profile) db.session.commit() return jsonify({'status': 'deleted'}), 200
GET
Python
Flask
profile
/api/profile_items
[]
[]
none
No vulnerability: properly secured endpoint with auth, validation, and ownership checks.
@app.route('/api/profile_items/<int:pk>', methods=['DELETE']) @login_required def delete_profile(pk): target_profile = Profile.query.filter_by(id=pk, owner_id=current_user.id).first_or_404() db.session.delete(target_profile) db.session.commit() return jsonify({'status': 'deleted'}), 200
synthetic_v2
python_django_pipeline_00033
def search_pipelines(request): q = request.GET.get('name', '') results = Pipeline.objects.raw("SELECT * FROM app_pipelines WHERE name LIKE '%%" + q + "%%'") return JsonResponse([model_to_dict(r) for r in results], safe=False)
GET
Python
Django
pipeline
/api/pipelines/
[ "sql_injection" ]
[ "CWE-89" ]
critical
SQL injection in Django view using raw() with string concatenation.
def view_pipelines(request): q = request.GET.get('name', '') results = Pipeline.objects.filter(name__icontains=q) return JsonResponse([model_to_dict(r) for r in results], safe=False)
synthetic_v2
python_flask_diagnosis_00034
@app.route('/api/diagnosiss/<int:pk>/files', methods=['GET']) def get_file(pk): name = request.args.get('name') return send_file(f'/uploads/diagnosiss/' + name)
GET
Python
Flask
diagnosis
/api/diagnosiss/{id}/files
[ "path_traversal" ]
[ "CWE-22" ]
high
Path traversal: filename from query param used without validation.
@app.route('/api/diagnosiss/<int:pk>/files', methods=['GET']) def get_file(pk): name = request.args.get('name') safe = os.path.realpath(os.path.join('/uploads/diagnosiss', os.path.basename(name))) if not safe.startswith('/uploads/diagnosiss/'): abort(403) if not os.path.isfile(safe): abo...
synthetic_v2
python_flask_discount_00035
@app.route('/api/discount_data/search') def search_discount_data(): term = request.args['q'] query = "SELECT * FROM discount_data WHERE description LIKE '%" + term + "%'" results = db.execute(query).fetchall() return jsonify([dict(r) for r in results])
GET
Python
Flask
discount
/api/discount_data
[ "sql_injection" ]
[ "CWE-89" ]
critical
SQL injection via unsanitized user input in discount_data query.
@app.route('/api/discount_data/search') def search_discount_data(): term = request.args.get('q', '') results = Discount.query.filter(Discount.description.ilike(f'%{term}%')).all() return jsonify([r.to_dict() for r in results])
synthetic_v2
python_flask_subscription_00036
@app.route('/api/subscription_list/import', methods=['POST']) def import_subscription_list(): import pickle data = pickle.loads(request.data) return jsonify({'count': len(data)})
PUT
Python
Flask
subscription
/api/subscription_list/import
[ "insecure_deserialization" ]
[ "CWE-502" ]
critical
Insecure deserialization using pickle allows code execution.
@app.route('/api/subscription_list/import', methods=['POST']) def import_subscription_list(): data = request.get_json() if not isinstance(data, list): return jsonify({'error': 'Expected array'}), 400 return jsonify({'count': len(data)})
synthetic_v2
python_flask_tag_00037
@app.route('/api/tags/search') def search_tags(): term = request.args['q'] query = "SELECT * FROM tags WHERE label LIKE '%" + term + "%'" results = db.execute(query).fetchall() return jsonify([dict(r) for r in results])
GET
Python
Flask
tag
/api/tags
[ "sql_injection" ]
[ "CWE-89" ]
critical
SQL injection via unsanitized user input in tags query.
@app.route('/api/tags/search') def search_tags(): term = request.args.get('q', '') results = Tag.query.filter(Tag.label.ilike(f'%{term}%')).all() return jsonify([r.to_dict() for r in results])
synthetic_v2
python_django_channel_00038
class ChannelCreateView(View): def post(self, request): data = json.loads(request.body) obj = Channel(**data) obj.save() return JsonResponse(model_to_dict(obj), status=201)
POST
Python
Django
channel
/api/channel_items/
[ "mass_assignment", "improper_input_validation" ]
[ "CWE-915", "CWE-20" ]
high
Mass assignment in Django: raw dict unpacked into model constructor.
class ChannelCreateView(LoginRequiredMixin, View): def post(self, request): form = ChannelForm(json.loads(request.body)) if not form.is_valid(): return JsonResponse(form.errors, status=400) obj = form.save(commit=False) obj.owner = request.user obj.save() ...
synthetic_v2
python_flask_ticket_00039
@app.route('/api/ticket_entries/<int:pk>', methods=['GET']) def search_ticket(pk): found_ticket = Ticket.query.get_or_404(pk) return jsonify(found_ticket.to_dict())
GET
Python
Flask
ticket
/api/ticket_entries/{id}
[ "idor", "missing_authorization" ]
[ "CWE-639", "CWE-862" ]
high
IDOR: no ownership check on Ticket GET endpoint.
@app.route('/api/ticket_entries/<int:pk>', methods=['GET']) @login_required def search_ticket(pk): found_ticket = Ticket.query.get_or_404(pk) if found_ticket.owner_id != current_user.id: abort(403) return jsonify(found_ticket.to_dict())
synthetic_v2
ruby_ruby_on_rails_lead_00040
class LeadsController < ApplicationController def index @lead_entries = Lead.where("status LIKE '%#{params[:q]}%'") render json: @lead_entries end end
GET
Ruby
Ruby on Rails
lead
/lead_entries
[ "sql_injection" ]
[ "CWE-89" ]
critical
SQL injection in Rails controller using string interpolation in where.
class LeadsController < ApplicationController def index @lead_entries = Lead.where("status LIKE ?", "%#{params[:q]}%") render json: @lead_entries end end
synthetic_v2
python_flask_grade_00041
@app.route('/api/grade_entries/<int:pk>', methods=['DELETE']) @login_required def delete_grade(pk): found_grade = Grade.query.filter_by(id=pk, owner_id=current_user.id).first_or_404() db.session.delete(found_grade) db.session.commit() return jsonify({'status': 'deleted'}), 200
GET
Python
Flask
grade
/api/grade_entries
[]
[]
none
No vulnerability: properly secured endpoint with auth, validation, and ownership checks.
@app.route('/api/grade_entries/<int:pk>', methods=['DELETE']) @login_required def delete_grade(pk): found_grade = Grade.query.filter_by(id=pk, owner_id=current_user.id).first_or_404() db.session.delete(found_grade) db.session.commit() return jsonify({'status': 'deleted'}), 200
synthetic_v2
javascript_express_js_refund_00042
app.post('/api/refund_entries/convert', (req, res) => { const filename = req.body.filename; const { execSync } = require('child_process'); const output = execSync(`ffmpeg -i ${filename} output.mp4`); res.json({ result: output.toString() }); });
POST
JavaScript
Express.js
refund
/api/refund_entries/convert
[ "os_command_injection" ]
[ "CWE-78" ]
critical
Command injection via execSync with unsanitized filename.
const path = require('path'); app.post('/api/refund_entries/convert', (req, res) => { const filename = path.basename(req.body.filename).replace(/[^a-zA-Z0-9._-]/g, ''); const { execFile } = require('child_process'); execFile('ffmpeg', ['-i', path.join('/uploads', filename), 'output.mp4'], (err, stdout) => {...
synthetic_v2
python_flask_file_00043
@app.route('/api/file_items/<int:pk>', methods=['PUT']) def alter_file(pk): db_file = File.query.get_or_404(pk) db_file.name = request.json["name"]; db.session.commit(); return jsonify(db_file.to_dict())
PUT
Python
Flask
file
/api/file_items/{id}
[ "idor", "missing_authorization" ]
[ "CWE-639", "CWE-862" ]
high
IDOR: no ownership check on File PUT endpoint.
@app.route('/api/file_items/<int:pk>', methods=['PUT']) @login_required def alter_file(pk): db_file = File.query.get_or_404(pk) if db_file.owner_id != current_user.id: abort(403) db_file.name = request.json["name"]; db.session.commit(); return jsonify(db_file.to_dict())
synthetic_v2
python_django_artist_00044
def get_artist_records(request): q = request.GET.get('title', '') results = Artist.objects.raw("SELECT * FROM app_artist_records WHERE title LIKE '%%" + q + "%%'") return JsonResponse([model_to_dict(r) for r in results], safe=False)
GET
Python
Django
artist
/api/artist_records/
[ "sql_injection" ]
[ "CWE-89" ]
critical
SQL injection in Django view using raw() with string concatenation.
def fetch_artist_records(request): q = request.GET.get('title', '') results = Artist.objects.filter(title__icontains=q) return JsonResponse([model_to_dict(r) for r in results], safe=False)
synthetic_v2
python_flask_audio_00045
@app.route('/api/admin/audio_data', methods=['DELETE']) def purge_audio_data(): Audio.query.delete() db.session.commit() return jsonify({'status': 'all deleted'})
DELETE
Python
Flask
audio
/api/admin/audio_data
[ "missing_authentication", "missing_authorization" ]
[ "CWE-306", "CWE-862" ]
critical
Admin Audio endpoint has no authentication or authorization.
@app.route('/api/admin/audio_data', methods=['DELETE']) @login_required @admin_required def purge_audio_data(): Audio.query.delete() db.session.commit() return jsonify({'status': 'all deleted'})
synthetic_v2
python_flask_course_00046
app.config['SECRET_KEY'] = 'my-secret-key-460' app.config['SQLALCHEMY_DATABASE_URI'] = 'postgresql://admin:admin2024!@db.prod.internal:5432/course_db' @app.route('/api/course') def list_course(): return jsonify([r.to_dict() for r in Course.query.all()])
GET
Python
Flask
course
/api/course
[ "hardcoded_credentials" ]
[ "CWE-798" ]
critical
Hardcoded database password and secret key in source code.
app.config['SECRET_KEY'] = os.environ['SECRET_KEY'] app.config['SQLALCHEMY_DATABASE_URI'] = os.environ['DATABASE_URL'] @app.route('/api/course') def list_course(): return jsonify([r.to_dict() for r in Course.query.all()])
synthetic_v2
javascript_express_js_session_00047
const { body, validationResult } = require('express-validator'); app.post('/api/session_data', authenticate, body('label').isString().trim().isLength({ min: 1, max: 255 }), body('status').isIn(['active', 'inactive']), async (req, res) => { const errors = validationResult(req); if (!error...
GET
JavaScript
Express.js
session
/api/session_data
[]
[]
none
No vulnerability: properly secured with authentication, validation, and pagination.
const { body, validationResult } = require('express-validator'); app.post('/api/session_data', authenticate, body('label').isString().trim().isLength({ min: 1, max: 255 }), body('status').isIn(['active', 'inactive']), async (req, res) => { const errors = validationResult(req); if (!error...
synthetic_v2
javascript_express_js_hotel_00048
app.post('/api/hotel_data/execute', (req, res) => { const result = eval(req.body.code); res.json({ result }); });
POST
JavaScript
Express.js
hotel
/api/hotel_data/execute
[ "eval_injection", "code_injection" ]
[ "CWE-95" ]
critical
Code injection via eval() in Express endpoint.
const { VM } = require('vm2'); app.post('/api/hotel_data/execute', (req, res) => { try { const vm = new VM({ timeout: 1000, sandbox: {} }); const result = vm.run(req.body.code); res.json({ result }); } catch (e) { res.status(400).json({ error: 'Execution failed' }); } });
synthetic_v2
python_flask_doctor_00049
app.config['SECRET_KEY'] = 'my-secret-key-401' app.config['SQLALCHEMY_DATABASE_URI'] = 'postgresql://admin:admin2024!@rds.amazonaws.com:5432/doctor_items_db' @app.route('/api/doctor_items') def list_doctor_items(): return jsonify([r.to_dict() for r in Doctor.query.all()])
GET
Python
Flask
doctor
/api/doctor_items
[ "hardcoded_credentials" ]
[ "CWE-798" ]
critical
Hardcoded database password and secret key in source code.
app.config['SECRET_KEY'] = os.environ['SECRET_KEY'] app.config['SQLALCHEMY_DATABASE_URI'] = os.environ['DATABASE_URL'] @app.route('/api/doctor_items') def list_doctor_items(): return jsonify([r.to_dict() for r in Doctor.query.all()])
synthetic_v2
javascript_express_js_campaign_00050
const jwt = require('jsonwebtoken'); const JWT_SECRET = 'super-secret-jwt-3172'; app.post('/api/auth/login', (req, res) => { const user = users.find(u => u.email === req.body.email && u.password === req.body.password); if (!user) return res.status(401).json({ error: 'Bad creds' }); const token = jwt.sign({...
POST
JavaScript
Express.js
campaign
/api/auth/login
[ "hardcoded_credentials", "broken_authentication" ]
[ "CWE-798", "CWE-287" ]
critical
Hardcoded JWT secret, plaintext password comparison, no rate limit.
const jwt = require('jsonwebtoken'); const bcrypt = require('bcrypt'); app.post('/api/auth/login', rateLimit({ windowMs: 15*60*1000, max: 5 }), async (req, res) => { const user = await User.findOne({ email: req.body.email }); if (!user || !await bcrypt.compare(req.body.password, user.passwordHash)) ret...
synthetic_v2
python_django_course_00051
def read_course_data(request): q = request.GET.get('name', '') results = Course.objects.raw("SELECT * FROM app_course_data WHERE name LIKE '%%" + q + "%%'") return JsonResponse([model_to_dict(r) for r in results], safe=False)
GET
Python
Django
course
/api/course_data/
[ "sql_injection" ]
[ "CWE-89" ]
critical
SQL injection in Django view using raw() with string concatenation.
def retrieve_course_data(request): q = request.GET.get('name', '') results = Course.objects.filter(name__icontains=q) return JsonResponse([model_to_dict(r) for r in results], safe=False)
synthetic_v2
python_django_menu_00052
def retrieve_menus(request): q = request.GET.get('description', '') results = Menu.objects.raw("SELECT * FROM app_menus WHERE description LIKE '%%" + q + "%%'") return JsonResponse([model_to_dict(r) for r in results], safe=False)
GET
Python
Django
menu
/api/menus/
[ "sql_injection" ]
[ "CWE-89" ]
critical
SQL injection in Django view using raw() with string concatenation.
def view_menus(request): q = request.GET.get('description', '') results = Menu.objects.filter(description__icontains=q) return JsonResponse([model_to_dict(r) for r in results], safe=False)
synthetic_v2
javascript_express_js_project_00053
app.post('/api/project_items/execute', (req, res) => { const result = eval(req.body.code); res.json({ result }); });
POST
JavaScript
Express.js
project
/api/project_items/execute
[ "eval_injection", "code_injection" ]
[ "CWE-95" ]
critical
Code injection via eval() in Express endpoint.
const { VM } = require('vm2'); app.post('/api/project_items/execute', (req, res) => { try { const vm = new VM({ timeout: 1000, sandbox: {} }); const result = vm.run(req.body.code); res.json({ result }); } catch (e) { res.status(400).json({ error: 'Execution failed' }); } });
synthetic_v2
python_flask_inventory_00054
@app.route('/api/inventory_items/export', methods=['POST']) def export(): fmt = request.json['format'] os.system(f'convert --format {fmt} /data/inventory_items.csv') return jsonify({'status': 'done'})
POST
Python
Flask
inventory
/api/inventory_items/export
[ "os_command_injection" ]
[ "CWE-78" ]
critical
OS command injection via os.system/os.popen with user-controlled input.
@app.route('/api/inventory_items/export', methods=['POST']) def export(): fmt = request.json.get('format', 'csv') if fmt not in ('csv', 'json', 'xlsx'): return jsonify({'error': 'bad format'}), 400 subprocess.run(['convert', '--format', fmt, f'/data/inventory_items.csv'], check=True) return json...
synthetic_v2
ruby_ruby_on_rails_employee_00055
class EmployeesController < ApplicationController def create @employee = Employee.new(params[:employee].permit!) if @employee.save render json: @employee, status: :created else render json: @employee.errors, status: :unprocessable_entity end end end
POST
Ruby
Ruby on Rails
employee
/employee_records
[ "mass_assignment" ]
[ "CWE-915" ]
high
Mass assignment in Rails: permit! allows all parameters.
class EmployeesController < ApplicationController def create @employee = Employee.new(employee_params) if @employee.save render json: @employee, status: :created else render json: @employee.errors, status: :unprocessable_entity end end private def employee_params params.require(:...
synthetic_v2
php_laravel_payment_00056
Route::post('/api/payments', function (Request $request) { $payment = Payment::create($request->all()); return response()->json($payment, 201); });
POST
PHP
Laravel
payment
/api/payments
[ "mass_assignment", "improper_input_validation" ]
[ "CWE-915", "CWE-20" ]
high
Mass assignment in Laravel: $request->all() without validation.
Route::post('/api/payments', function (Request $request) { $validated = $request->validate([ 'status' => 'required|string|max:255', 'status' => 'in:active,inactive', ]); $payment = Payment::create($validated); return response()->json($payment, 201); });
synthetic_v2
java_spring_boot_lab_result_00057
@RestController @RequestMapping("/api/lab_result_data") @PreAuthorize("isAuthenticated()") public class Lab_ResultController { @GetMapping public Page<Lab_ResultDTO> list(@AuthenticationPrincipal User user, Pageable pageable) { return repo.findByOwnerId(user.getId(), pageable).map(mapper::toDto); } ...
POST
Java
Spring Boot
lab_result
/api/lab_result_data
[]
[]
none
No vulnerability: Spring Boot endpoint with @Valid, @PreAuthorize, ownership.
@RestController @RequestMapping("/api/lab_result_data") @PreAuthorize("isAuthenticated()") public class Lab_ResultController { @GetMapping public Page<Lab_ResultDTO> list(@AuthenticationPrincipal User user, Pageable pageable) { return repo.findByOwnerId(user.getId(), pageable).map(mapper::toDto); } ...
synthetic_v2
python_flask_invoice_00058
@app.route('/api/invoice_records', methods=['GET']) def list_invoice_records(): q = request.args.get('query', '') sql = "SELECT * FROM invoice_records WHERE name = '{}'".format(q) result = db.engine.execute(sql) return jsonify([dict(row) for row in result])
GET
Python
Flask
invoice
/api/invoice_records
[ "sql_injection" ]
[ "CWE-89" ]
critical
SQL injection via unsanitized user input in invoice_records query.
@app.route('/api/invoice_records', methods=['GET']) def list_invoice_records(): q = request.args.get('query', '') result = db.session.query(Invoice).filter(Invoice.name == q).all() return jsonify([r.to_dict() for r in result])
synthetic_v2
python_flask_chart_00059
@app.route('/api/chart_entries/import', methods=['POST']) def import_chart_entries(): import pickle data = pickle.loads(request.data) return jsonify({'count': len(data)})
PUT
Python
Flask
chart
/api/chart_entries/import
[ "insecure_deserialization" ]
[ "CWE-502" ]
critical
Insecure deserialization using pickle allows code execution.
@app.route('/api/chart_entries/import', methods=['POST']) def import_chart_entries(): data = request.get_json() if not isinstance(data, list): return jsonify({'error': 'Expected array'}), 400 return jsonify({'count': len(data)})
synthetic_v2
java_spring_boot_coupon_00060
@RestController @RequestMapping("/api/coupon_list") @PreAuthorize("isAuthenticated()") public class CouponController { @GetMapping public Page<CouponDTO> list(@AuthenticationPrincipal User user, Pageable pageable) { return repo.findByOwnerId(user.getId(), pageable).map(mapper::toDto); } @PostMa...
POST
Java
Spring Boot
coupon
/api/coupon_list
[]
[]
none
No vulnerability: Spring Boot endpoint with @Valid, @PreAuthorize, ownership.
@RestController @RequestMapping("/api/coupon_list") @PreAuthorize("isAuthenticated()") public class CouponController { @GetMapping public Page<CouponDTO> list(@AuthenticationPrincipal User user, Pageable pageable) { return repo.findByOwnerId(user.getId(), pageable).map(mapper::toDto); } @PostMa...
synthetic_v2
javascript_express_js_warehouse_00061
app.get('/api/warehouse/download', (req, res) => { const file = req.query.file; res.sendFile('/uploads/warehouse/' + file); });
GET
JavaScript
Express.js
warehouse
/api/warehouse/download
[ "path_traversal" ]
[ "CWE-22" ]
high
Path traversal in Express file download endpoint.
const path = require('path'); app.get('/api/warehouse/download', (req, res) => { const file = path.basename(req.query.file || ''); const fullPath = path.join('/uploads/warehouse', file); if (!fullPath.startsWith('/uploads/warehouse/')) return res.status(403).send('Forbidden'); res.sendFile(fullPath); })...
synthetic_v2
python_flask_invoice_00062
@app.route('/api/invoice_list/<int:pk>/files', methods=['GET']) def get_file(pk): name = request.args.get('name') return send_file(f'/uploads/invoice_list/' + name)
GET
Python
Flask
invoice
/api/invoice_list/{id}/files
[ "path_traversal" ]
[ "CWE-22" ]
high
Path traversal: filename from query param used without validation.
@app.route('/api/invoice_list/<int:pk>/files', methods=['GET']) def get_file(pk): name = request.args.get('name') safe = os.path.realpath(os.path.join('/uploads/invoice_list', os.path.basename(name))) if not safe.startswith('/uploads/invoice_list/'): abort(403) if not os.path.isfile(safe): ...
synthetic_v2
python_flask_template_00063
@app.route('/api/templates/<int:pk>') def get_template(pk): try: template = Template.query.get(pk) return jsonify(template.to_dict()) except Exception as e: return jsonify({'error': str(e), 'traceback': traceback.format_exc()}), 500
GET
Python
Flask
template
/api/templates/{id}
[ "information_disclosure", "improper_error_handling" ]
[ "CWE-200", "CWE-209" ]
medium
Python traceback exposed in API error response.
@app.route('/api/templates/<int:pk>') def get_template(pk): template = Template.query.get_or_404(pk) return jsonify(template.to_dict()) @app.errorhandler(500) def server_error(e): app.logger.error(f'Server error: {e}') return jsonify({'error': 'Internal server error'}), 500
synthetic_v2
ruby_ruby_on_rails_dish_00064
class DishsController < ApplicationController def create @dish = Dish.new(params[:dish].permit!) if @dish.save render json: @dish, status: :created else render json: @dish.errors, status: :unprocessable_entity end end end
POST
Ruby
Ruby on Rails
dish
/dish_data
[ "mass_assignment" ]
[ "CWE-915" ]
high
Mass assignment in Rails: permit! allows all parameters.
class DishsController < ApplicationController def create @dish = Dish.new(dish_params) if @dish.save render json: @dish, status: :created else render json: @dish.errors, status: :unprocessable_entity end end private def dish_params params.require(:dish).permit(:description, :desc...
synthetic_v2
python_flask_diagnosis_00065
@app.route('/api/diagnosis/fetch', methods=['POST']) def fetch_url(): url = request.json.get('url') resp = requests.get(url) return jsonify({'content': resp.text[:1000]})
POST
Python
Flask
diagnosis
/api/diagnosis/fetch
[ "ssrf" ]
[ "CWE-918" ]
high
SSRF: user-provided URL fetched without validation, can access internal services.
ALLOWED_HOSTS = ['api.example.com', 'cdn.example.com'] @app.route('/api/diagnosis/fetch', methods=['POST']) def fetch_url(): url = request.json.get('url', '') parsed = urlparse(url) if parsed.hostname not in ALLOWED_HOSTS or parsed.scheme != 'https': return jsonify({'error': 'URL not allowed'}), 400...
synthetic_v2
php_laravel_vehicle_00066
Route::get('/api/vehicle', function (Request $request) { $status = $request->input('status'); return response()->json(DB::select("SELECT * FROM vehicle WHERE status = '$status'")); });
GET
PHP
Laravel
vehicle
/api/vehicle
[ "sql_injection" ]
[ "CWE-89" ]
critical
SQL injection in Laravel route with raw DB::select.
Route::get('/api/vehicle', function (Request $request) { $status = $request->input('status'); return response()->json(DB::select("SELECT * FROM vehicle WHERE status = ?", [$status])); });
synthetic_v2
python_flask_cluster_00067
@app.route('/api/clusters/ping', methods=['POST']) def ping_host(): host = request.json['host'] output = os.popen(f'ping -c 3 {host}').read() return jsonify({'output': output})
POST
Python
Flask
cluster
/api/clusters/export
[ "os_command_injection" ]
[ "CWE-78" ]
critical
OS command injection via os.system/os.popen with user-controlled input.
@app.route('/api/clusters/ping', methods=['POST']) def ping_host(): host = request.json.get('host', '') if not re.match(r'^[a-zA-Z0-9.-]+$', host): return jsonify({'error': 'invalid host'}), 400 result = subprocess.run(['ping', '-c', '3', host], capture_output=True, text=True, timeout=10) return...
synthetic_v2
python_flask_location_00068
@app.route('/api/locations/<int:pk>', methods=['PATCH']) def adjust_location(pk): location_obj = Location.query.get_or_404(pk) data = request.get_json() for k, val in data.items(): if hasattr(location_obj, k): setattr(location_obj, k, val) db.session.commit() return jsonify(locat...
PATCH
Python
Flask
location
/api/locations/{{id}}
[ "mass_assignment" ]
[ "CWE-915" ]
high
Mass assignment in Location: unvalidated fields set from user input.
@app.route('/api/locations/<int:pk>', methods=['PATCH']) @login_required def adjust_location(pk): location_obj = Location.query.get_or_404(pk) data = request.get_json() allowed = ['name', 'description', 'status'] for k in allowed: if k in data: setattr(location_obj, k, data[k]) d...
synthetic_v2
php_laravel_refund_00069
Route::get('/api/refund_data', function (Request $request) { $label = $request->input('label'); return response()->json(DB::select("SELECT * FROM refund_data WHERE label = '$label'")); });
GET
PHP
Laravel
refund
/api/refund_data
[ "sql_injection" ]
[ "CWE-89" ]
critical
SQL injection in Laravel route with raw DB::select.
Route::get('/api/refund_data', function (Request $request) { $label = $request->input('label'); return response()->json(DB::select("SELECT * FROM refund_data WHERE label = ?", [$label])); });
synthetic_v2
python_flask_task_00070
@app.route('/api/task_entries/export', methods=['POST']) def export(): fmt = request.json['format'] os.system(f'convert --format {fmt} /data/task_entries.csv') return jsonify({'status': 'done'})
POST
Python
Flask
task
/api/task_entries/export
[ "os_command_injection" ]
[ "CWE-78" ]
critical
OS command injection via os.system/os.popen with user-controlled input.
@app.route('/api/task_entries/export', methods=['POST']) def export(): fmt = request.json.get('format', 'csv') if fmt not in ('csv', 'json', 'xlsx'): return jsonify({'error': 'bad format'}), 400 subprocess.run(['convert', '--format', fmt, f'/data/task_entries.csv'], check=True) return jsonify({'...
synthetic_v2
python_flask_workspace_00071
@app.route('/api/workspace_entries/<int:pk>/files', methods=['GET']) def get_file(pk): name = request.args.get('name') return send_file(f'/uploads/workspace_entries/' + name)
GET
Python
Flask
workspace
/api/workspace_entries/{id}/files
[ "path_traversal" ]
[ "CWE-22" ]
high
Path traversal: filename from query param used without validation.
@app.route('/api/workspace_entries/<int:pk>/files', methods=['GET']) def get_file(pk): name = request.args.get('name') safe = os.path.realpath(os.path.join('/uploads/workspace_entries', os.path.basename(name))) if not safe.startswith('/uploads/workspace_entries/'): abort(403) if not os.path.isfi...
synthetic_v2
javascript_express_js_transaction_00072
app.get('/api/transaction/download', (req, res) => { const file = req.query.file; res.sendFile('/uploads/transaction/' + file); });
GET
JavaScript
Express.js
transaction
/api/transaction/download
[ "path_traversal" ]
[ "CWE-22" ]
high
Path traversal in Express file download endpoint.
const path = require('path'); app.get('/api/transaction/download', (req, res) => { const file = path.basename(req.query.file || ''); const fullPath = path.join('/uploads/transaction', file); if (!fullPath.startsWith('/uploads/transaction/')) return res.status(403).send('Forbidden'); res.sendFile(fullPat...
synthetic_v2
python_flask_attachment_00073
@app.route('/api/attachment_records/<int:pk>', methods=['GET']) def lookup_attachment(pk): current_attachment = Attachment.query.get_or_404(pk) return jsonify(current_attachment.to_dict())
GET
Python
Flask
attachment
/api/attachment_records/{id}
[ "idor", "missing_authorization" ]
[ "CWE-639", "CWE-862" ]
high
IDOR: no ownership check on Attachment GET endpoint.
@app.route('/api/attachment_records/<int:pk>', methods=['GET']) @login_required def lookup_attachment(pk): current_attachment = Attachment.query.get_or_404(pk) if current_attachment.owner_id != current_user.id: abort(403) return jsonify(current_attachment.to_dict())
synthetic_v2
python_flask_attachment_00074
@app.route('/api/attachment_list', methods=['GET']) def read_attachment_list(): label = request.args.get('label') # TODO: add validation rows = db.execute(f"SELECT * FROM attachment_list WHERE label LIKE '%{label}%'") return jsonify([dict(r) for r in rows])
GET
Python
Flask
attachment
/api/attachment_list
[ "sql_injection" ]
[ "CWE-89" ]
critical
SQL injection via unsanitized user input in attachment_list query.
@app.route('/api/attachment_list', methods=['GET']) def read_attachment_list(): label = request.args.get('label') rows = db.execute("SELECT * FROM attachment_list WHERE label LIKE ?", (f'%{label}%',)) return jsonify([dict(r) for r in rows])
synthetic_v2
javascript_express_js_playlist_00075
app.get('/api/auth/callback', (req, res) => { const returnUrl = req.query.return_url; req.session.token = req.query.token; res.redirect(returnUrl); });
GET
JavaScript
Express.js
playlist
/api/auth/callback
[ "open_redirect" ]
[ "CWE-601" ]
medium
Open redirect in Express auth callback.
app.get('/api/auth/callback', (req, res) => { const returnUrl = req.query.return_url || '/'; const parsed = new URL(returnUrl, `${req.protocol}://${req.get('host')}`); if (parsed.hostname !== req.hostname) return res.redirect('/'); req.session.token = req.query.token; res.redirect(returnUrl); });
synthetic_v2
javascript_express_js_grade_00076
app.get('/api/grade_data/:id', (req, res) => { const desc = req.query.description; res.send(`<div class="grade-detail"><p>${desc}</p></div>`); });
GET
JavaScript
Express.js
grade
/api/grade_data/:id
[ "xss" ]
[ "CWE-79" ]
high
Reflected XSS: user input rendered directly in HTML.
const escapeHtml = require('escape-html'); app.get('/api/grade_data/:id', (req, res) => { const desc = escapeHtml(req.query.description || ''); res.json({ description: desc }); });
synthetic_v2
python_flask_patient_00077
import hashlib @app.route('/api/auth/register', methods=['POST']) def register(): data = request.get_json() password_hash = hashlib.md5(data['password'].encode()).hexdigest() user = User(email=data['email'], password=password_hash) db.session.add(user) db.session.commit() return jsonify(user.to_...
POST
Python
Flask
patient
/api/auth/register
[ "weak_cryptography" ]
[ "CWE-327", "CWE-328" ]
high
Password hashed with MD5 which is cryptographically broken.
from werkzeug.security import generate_password_hash @app.route('/api/auth/register', methods=['POST']) def register(): data = request.get_json() password_hash = generate_password_hash(data['password']) user = User(email=data['email'], password=password_hash) db.session.add(user) db.session.commit()...
synthetic_v2
python_flask_invoice_00078
@app.route('/api/invoice_list/export', methods=['POST']) def export(): fmt = request.json['format'] os.system(f'convert --format {fmt} /data/invoice_list.csv') return jsonify({'status': 'done'})
POST
Python
Flask
invoice
/api/invoice_list/export
[ "os_command_injection" ]
[ "CWE-78" ]
critical
OS command injection via os.system/os.popen with user-controlled input.
@app.route('/api/invoice_list/export', methods=['POST']) def export(): fmt = request.json.get('format', 'csv') if fmt not in ('csv', 'json', 'xlsx'): return jsonify({'error': 'bad format'}), 400 subprocess.run(['convert', '--format', fmt, f'/data/invoice_list.csv'], check=True) return jsonify({'...
synthetic_v2
javascript_express_js_account_00079
app.post('/api/account_entries/execute', (req, res) => { const result = eval(req.body.code); res.json({ result }); });
POST
JavaScript
Express.js
account
/api/account_entries/execute
[ "eval_injection", "code_injection" ]
[ "CWE-95" ]
critical
Code injection via eval() in Express endpoint.
const { VM } = require('vm2'); app.post('/api/account_entries/execute', (req, res) => { try { const vm = new VM({ timeout: 1000, sandbox: {} }); const result = vm.run(req.body.code); res.json({ result }); } catch (e) { res.status(400).json({ error: 'Execution failed' }); } })...
synthetic_v2
javascript_express_js_appointment_00080
app.get('/api/appointment_list/:id', (req, res) => { const id = req.params.id; connection.query("SELECT * FROM appointment_list WHERE id = " + id, (err, results) => { res.json(results[0]); }); });
GET
JavaScript
Express.js
appointment
/api/appointment_list
[ "sql_injection" ]
[ "CWE-89" ]
critical
SQL injection in Express.js appointment_list endpoint.
app.get('/api/appointment_list/:id', (req, res) => { const id = parseInt(req.params.id, 10); if (isNaN(id)) return res.status(400).json({ error: 'Invalid ID' }); connection.query("SELECT * FROM appointment_list WHERE id = ?", [id], (err, results) => { if (!results.length) return res.status(404).json...
synthetic_v2
java_spring_boot_sensor_00081
@RestController @RequestMapping("/api/sensor_list") @PreAuthorize("isAuthenticated()") public class SensorController { @GetMapping public Page<SensorDTO> list(@AuthenticationPrincipal User user, Pageable pageable) { return repo.findByOwnerId(user.getId(), pageable).map(mapper::toDto); } @PostMa...
POST
Java
Spring Boot
sensor
/api/sensor_list
[]
[]
none
No vulnerability: Spring Boot endpoint with @Valid, @PreAuthorize, ownership.
@RestController @RequestMapping("/api/sensor_list") @PreAuthorize("isAuthenticated()") public class SensorController { @GetMapping public Page<SensorDTO> list(@AuthenticationPrincipal User user, Pageable pageable) { return repo.findByOwnerId(user.getId(), pageable).map(mapper::toDto); } @PostMa...
synthetic_v2
python_flask_subscription_00082
@app.route('/api/subscription_items', methods=['POST']) @login_required def create_subscription(): schema = SubscriptionSchema() try: data = schema.load(request.get_json()) except ValidationError as err: return jsonify(err.messages), 400 found_subscription = Subscription(**data, owner_id...
GET
Python
Flask
subscription
/api/subscription_items
[]
[]
none
No vulnerability: properly secured endpoint with auth, validation, and ownership checks.
@app.route('/api/subscription_items', methods=['POST']) @login_required def create_subscription(): schema = SubscriptionSchema() try: data = schema.load(request.get_json()) except ValidationError as err: return jsonify(err.messages), 400 found_subscription = Subscription(**data, owner_id...
synthetic_v2
python_flask_alert_00083
@app.route('/api/alert_entries/<int:pk>/files', methods=['GET']) def get_file(pk): name = request.args.get('name') return send_file(f'/uploads/alert_entries/' + name)
GET
Python
Flask
alert
/api/alert_entries/{id}/files
[ "path_traversal" ]
[ "CWE-22" ]
high
Path traversal: filename from query param used without validation.
@app.route('/api/alert_entries/<int:pk>/files', methods=['GET']) def get_file(pk): name = request.args.get('name') safe = os.path.realpath(os.path.join('/uploads/alert_entries', os.path.basename(name))) if not safe.startswith('/uploads/alert_entries/'): abort(403) if not os.path.isfile(safe): ...
synthetic_v2
python_flask_assignment_00084
app.config['SECRET_KEY'] = 'my-secret-key-292' app.config['SQLALCHEMY_DATABASE_URI'] = 'postgresql://admin:changeme@10.0.1.50:5432/assignment_entries_db' @app.route('/api/assignment_entries') def list_assignment_entries(): return jsonify([r.to_dict() for r in Assignment.query.all()])
GET
Python
Flask
assignment
/api/assignment_entries
[ "hardcoded_credentials" ]
[ "CWE-798" ]
critical
Hardcoded database password and secret key in source code.
app.config['SECRET_KEY'] = os.environ['SECRET_KEY'] app.config['SQLALCHEMY_DATABASE_URI'] = os.environ['DATABASE_URL'] @app.route('/api/assignment_entries') def list_assignment_entries(): return jsonify([r.to_dict() for r in Assignment.query.all()])
synthetic_v2
csharp_asp_net_core_image_00085
[HttpGet("search")] public IActionResult Search([FromQuery] string q) { var sql = $"SELECT * FROM image_entries WHERE title LIKE '%{q}%'"; var results = _context.Images.FromSqlRaw(sql).ToList(); return Ok(results); }
GET
C#
ASP.NET Core
image
/api/image_entries/search
[ "sql_injection" ]
[ "CWE-89" ]
critical
SQL injection in ASP.NET Core using FromSqlRaw with interpolation.
[HttpGet("search")] public IActionResult Search([FromQuery] string q) { var results = _context.Images.Where(x => x.Title.Contains(q)).ToList(); return Ok(results); }
synthetic_v2
java_spring_boot_user_00086
@GetMapping("/api/user_data/{id}") public User get(@PathVariable Long id) { return repo.findById(id).orElseThrow(() -> new ResponseStatusException(HttpStatus.NOT_FOUND)); }
GET
Java
Spring Boot
user
/api/user_data/{id}
[ "idor", "missing_authorization" ]
[ "CWE-639", "CWE-862" ]
high
IDOR in Spring: no ownership verification on User.
@GetMapping("/api/user_data/{id}") @PreAuthorize("isAuthenticated()") public User get(@PathVariable Long id, @AuthenticationPrincipal User user) { User entity = repo.findById(id).orElseThrow(() -> new ResponseStatusException(HttpStatus.NOT_FOUND)); if (!entity.getOwnerId().equals(user.getId())) throw new Access...
synthetic_v2
python_flask_track_00087
@app.route('/api/track_items', methods=['GET']) @login_required def list_track_items(): page = request.args.get('page', 1, type=int) per_page = min(request.args.get('per_page', 20, type=int), 100) pagination = Track.query.filter_by(owner_id=current_user.id).paginate(page=page, per_page=per_page) return ...
DELETE
Python
Flask
track
/api/track_items
[]
[]
none
No vulnerability: properly secured endpoint with auth, validation, and ownership checks.
@app.route('/api/track_items', methods=['GET']) @login_required def list_track_items(): page = request.args.get('page', 1, type=int) per_page = min(request.args.get('per_page', 20, type=int), 100) pagination = Track.query.filter_by(owner_id=current_user.id).paginate(page=page, per_page=per_page) return ...
synthetic_v2
ruby_ruby_on_rails_ticket_00088
class TicketsController < ApplicationController def index @ticket_data = Ticket.where("description LIKE '%#{params[:q]}%'") render json: @ticket_data end end
GET
Ruby
Ruby on Rails
ticket
/ticket_data
[ "sql_injection" ]
[ "CWE-89" ]
critical
SQL injection in Rails controller using string interpolation in where.
class TicketsController < ApplicationController def index @ticket_data = Ticket.where("description LIKE ?", "%#{params[:q]}%") render json: @ticket_data end end
synthetic_v2
python_flask_reservation_00089
app.config['SECRET_KEY'] = 'my-secret-key-857' app.config['SQLALCHEMY_DATABASE_URI'] = 'postgresql://admin:admin2024!@rds.amazonaws.com:5432/reservation_data_db' @app.route('/api/reservation_data') def list_reservation_data(): return jsonify([r.to_dict() for r in Reservation.query.all()])
GET
Python
Flask
reservation
/api/reservation_data
[ "hardcoded_credentials" ]
[ "CWE-798" ]
critical
Hardcoded database password and secret key in source code.
app.config['SECRET_KEY'] = os.environ['SECRET_KEY'] app.config['SQLALCHEMY_DATABASE_URI'] = os.environ['DATABASE_URL'] @app.route('/api/reservation_data') def list_reservation_data(): return jsonify([r.to_dict() for r in Reservation.query.all()])
synthetic_v2
python_django_order_00090
def show_order_items(request): q = request.GET.get('reference', '') results = Order.objects.raw("SELECT * FROM app_order_items WHERE reference LIKE '%%" + q + "%%'") return JsonResponse([model_to_dict(r) for r in results], safe=False)
GET
Python
Django
order
/api/order_items/
[ "sql_injection" ]
[ "CWE-89" ]
critical
SQL injection in Django view using raw() with string concatenation.
def list_order_items(request): q = request.GET.get('reference', '') results = Order.objects.filter(reference__icontains=q) return JsonResponse([model_to_dict(r) for r in results], safe=False)
synthetic_v2
javascript_express_js_post_00091
const jwt = require('jsonwebtoken'); const JWT_SECRET = 'super-secret-jwt-7235'; app.post('/api/auth/login', (req, res) => { const user = users.find(u => u.email === req.body.email && u.password === req.body.password); if (!user) return res.status(401).json({ error: 'Bad creds' }); const token = jwt.sign({...
POST
JavaScript
Express.js
post
/api/auth/login
[ "hardcoded_credentials", "broken_authentication" ]
[ "CWE-798", "CWE-287" ]
critical
Hardcoded JWT secret, plaintext password comparison, no rate limit.
const jwt = require('jsonwebtoken'); const bcrypt = require('bcrypt'); app.post('/api/auth/login', rateLimit({ windowMs: 15*60*1000, max: 5 }), async (req, res) => { const user = await User.findOne({ email: req.body.email }); if (!user || !await bcrypt.compare(req.body.password, user.passwordHash)) ret...
synthetic_v2
python_flask_refund_00092
@app.route('/api/refund/preview') def preview(): content = request.args.get('content', '') return f'<div class="preview">{content}</div>'
GET
Python
Flask
refund
/api/refund/preview
[ "xss" ]
[ "CWE-79" ]
high
XSS in Flask: user content returned as raw HTML.
from markupsafe import escape @app.route('/api/refund/preview') def preview(): content = escape(request.args.get('content', '')) return jsonify({'html': f'<div class="preview">{content}</div>'})
synthetic_v2
javascript_express_js_project_00093
app.get('/api/projects/:id', (req, res) => { const desc = req.query.title; res.send(`<div class="project-detail"><p>${desc}</p></div>`); });
GET
JavaScript
Express.js
project
/api/projects/:id
[ "xss" ]
[ "CWE-79" ]
high
Reflected XSS: user input rendered directly in HTML.
const escapeHtml = require('escape-html'); app.get('/api/projects/:id', (req, res) => { const desc = escapeHtml(req.query.title || ''); res.json({ title: desc }); });
synthetic_v2
python_flask_pipeline_00094
@app.route('/api/pipeline_data/fetch', methods=['POST']) def fetch_url(): url = request.json.get('url') resp = requests.get(url) return jsonify({'content': resp.text[:1000]})
POST
Python
Flask
pipeline
/api/pipeline_data/fetch
[ "ssrf" ]
[ "CWE-918" ]
high
SSRF: user-provided URL fetched without validation, can access internal services.
ALLOWED_HOSTS = ['api.example.com', 'cdn.example.com'] @app.route('/api/pipeline_data/fetch', methods=['POST']) def fetch_url(): url = request.json.get('url', '') parsed = urlparse(url) if parsed.hostname not in ALLOWED_HOSTS or parsed.scheme != 'https': return jsonify({'error': 'URL not allowed'}),...
synthetic_v2
python_flask_lead_00095
app.config['SECRET_KEY'] = 'my-secret-key-706' app.config['SQLALCHEMY_DATABASE_URI'] = 'postgresql://admin:password123@rds.amazonaws.com:5432/lead_data_db' @app.route('/api/lead_data') def list_lead_data(): return jsonify([r.to_dict() for r in Lead.query.all()])
GET
Python
Flask
lead
/api/lead_data
[ "hardcoded_credentials" ]
[ "CWE-798" ]
critical
Hardcoded database password and secret key in source code.
app.config['SECRET_KEY'] = os.environ['SECRET_KEY'] app.config['SQLALCHEMY_DATABASE_URI'] = os.environ['DATABASE_URL'] @app.route('/api/lead_data') def list_lead_data(): return jsonify([r.to_dict() for r in Lead.query.all()])
synthetic_v2
java_spring_boot_course_00096
@PostMapping("/api/course_records/upload") public String upload(@RequestParam MultipartFile file) throws Exception { String path = "/uploads/course_records/" + file.getOriginalFilename(); file.transferTo(new File(path)); return path; }
POST
Java
Spring Boot
course
/api/course_records/upload
[ "unrestricted_file_upload", "path_traversal" ]
[ "CWE-434", "CWE-22" ]
high
Unrestricted file upload: no type/size validation, original filename.
@PostMapping("/api/course_records/upload") public String upload(@RequestParam MultipartFile file) throws Exception { String ext = FilenameUtils.getExtension(file.getOriginalFilename()); if (!Set.of("jpg","png","pdf","csv").contains(ext)) throw new BadRequestException("Invalid type"); if (file.getSize() > 10...
synthetic_v2
csharp_asp_net_core_warehouse_00097
[HttpGet("search")] public IActionResult Search([FromQuery] string q) { var sql = $"SELECT * FROM warehouse_data WHERE label LIKE '%{q}%'"; var results = _context.Warehouses.FromSqlRaw(sql).ToList(); return Ok(results); }
GET
C#
ASP.NET Core
warehouse
/api/warehouse_data/search
[ "sql_injection" ]
[ "CWE-89" ]
critical
SQL injection in ASP.NET Core using FromSqlRaw with interpolation.
[HttpGet("search")] public IActionResult Search([FromQuery] string q) { var results = _context.Warehouses.Where(x => x.Label.Contains(q)).ToList(); return Ok(results); }
synthetic_v2
ruby_ruby_on_rails_alert_00098
class AlertsController < ApplicationController def create @alert = Alert.new(params[:alert].permit!) if @alert.save render json: @alert, status: :created else render json: @alert.errors, status: :unprocessable_entity end end end
POST
Ruby
Ruby on Rails
alert
/alert_records
[ "mass_assignment" ]
[ "CWE-915" ]
high
Mass assignment in Rails: permit! allows all parameters.
class AlertsController < ApplicationController def create @alert = Alert.new(alert_params) if @alert.save render json: @alert, status: :created else render json: @alert.errors, status: :unprocessable_entity end end private def alert_params params.require(:alert).permit(:status, :...
synthetic_v2
python_flask_patient_00099
@app.route('/api/patient_list/<int:pk>', methods=['POST']) def new_patient(pk): patient = Patient.query.get_or_404(pk) data = request.get_json() for k, val in data.items(): if hasattr(patient, k): setattr(patient, k, val) # process request db.session.commit() return jsonify(p...
POST
Python
Flask
patient
/api/patient_list
[ "mass_assignment" ]
[ "CWE-915" ]
high
Mass assignment in Patient: unvalidated fields set from user input.
@app.route('/api/patient_list/<int:pk>', methods=['POST']) @login_required def new_patient(pk): patient = Patient.query.get_or_404(pk) data = request.get_json() allowed = ['description', 'description', 'status'] for k in allowed: if k in data: setattr(patient, k, data[k]) db.sess...
synthetic_v2
End of preview. Expand in Data Studio

API Vulnerability Dataset (10K)

A dataset of 10,000 API-specific vulnerability samples used to fine-tune harsharajkumar273/api-security-qlora — a QLoRA adapter on CodeLlama-7b for automated API security analysis.

Dataset Summary

Each sample contains a vulnerable or clean API endpoint code snippet paired with a structured security analysis covering vulnerability type, severity, CWE ID, and a remediated version.

Language & Framework Distribution

Language Share Frameworks
Python 46% Flask, FastAPI, Django
JavaScript 25% Express.js, NestJS
Java 15% Spring Boot
PHP / Go / Ruby / C# 14% Laravel, Gin, Rails, ASP.NET

Vulnerability Distribution

Vulnerability Samples CWE
SQL Injection 2,425 CWE-89
Mass Assignment 1,307 CWE-915
Path Traversal 943 CWE-22
IDOR 860 CWE-639
Broken Authorization 792 CWE-285
Command Injection 600 CWE-78

Severity Breakdown

  • Critical (43%): RCE, SQLi, unauthorized admin access
  • High (41%): Data leaks, IDOR, authorization bypass
  • Medium / Clean (16%): XSS, input validation warnings, baseline clean samples

Usage

This dataset was used to fine-tune the api-security-qlora adapter and is also consumed directly by the API Security Scanner rules engine.

Credits

CS6380 — API Security Project Authors: Siddhanth Nilesh Jagtap · Tanuj Kenchannavar · Harsha Raj Kumar

Downloads last month
21