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
python_flask_category_00300
@app.route('/api/categorys/<int:pk>', methods=['PUT']) def edit_category(pk): category_instance = Category.query.get_or_404(pk) category_instance.name = request.json["name"]; db.session.commit(); return jsonify(category_instance.to_dict())
PUT
Python
Flask
category
/api/categorys/{id}
[ "idor", "missing_authorization" ]
[ "CWE-639", "CWE-862" ]
high
IDOR: no ownership check on Category PUT endpoint.
@app.route('/api/categorys/<int:pk>', methods=['PUT']) @login_required def edit_category(pk): category_instance = Category.query.get_or_404(pk) if category_instance.owner_id != current_user.id: abort(403) category_instance.name = request.json["name"]; db.session.commit(); return jsonify(category_ins...
synthetic_v2
python_django_video_00301
class VideoCreateView(View): def post(self, request): data = json.loads(request.body) obj = Video(**data) obj.save() return JsonResponse(model_to_dict(obj), status=201)
POST
Python
Django
video
/api/video_items/
[ "mass_assignment", "improper_input_validation" ]
[ "CWE-915", "CWE-20" ]
high
Mass assignment in Django: raw dict unpacked into model constructor.
class VideoCreateView(LoginRequiredMixin, View): def post(self, request): form = VideoForm(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() retu...
synthetic_v2
ruby_ruby_on_rails_certificate_00302
class CertificatesController < ApplicationController def index @certificate_entries = Certificate.where("name LIKE '%#{params[:q]}%'") render json: @certificate_entries end end
GET
Ruby
Ruby on Rails
certificate
/certificate_entries
[ "sql_injection" ]
[ "CWE-89" ]
critical
SQL injection in Rails controller using string interpolation in where.
class CertificatesController < ApplicationController def index @certificate_entries = Certificate.where("name LIKE ?", "%#{params[:q]}%") render json: @certificate_entries end end
synthetic_v2
javascript_express_js_dashboard_00303
router.get('/api/dashboard_items/search', async (req, res) => { const q = req.query.q; const result = await pool.query(`SELECT * FROM dashboard_items WHERE status ILIKE '%${q}%'`); res.json(result.rows); });
GET
JavaScript
Express.js
dashboard
/api/dashboard_items
[ "sql_injection" ]
[ "CWE-89" ]
critical
SQL injection in Express.js dashboard_items endpoint.
router.get('/api/dashboard_items/search', async (req, res) => { const q = req.query.q; const result = await pool.query('SELECT * FROM dashboard_items WHERE status ILIKE $1', [`%${q}%`]); res.json(result.rows); });
synthetic_v2
go_gin_course_00304
func searchCourses(c *gin.Context) { q := c.Query("description") rows, _ := db.Query(fmt.Sprintf("SELECT * FROM courses WHERE description LIKE '%%%s%%'", q)) defer rows.Close() var results []Course for rows.Next() { var item Course rows.Scan(&item.ID, &item.Description) resul...
GET
Go
Gin
course
/api/courses
[ "sql_injection" ]
[ "CWE-89" ]
critical
SQL injection in Go Gin handler using fmt.Sprintf.
func searchCourses(c *gin.Context) { q := c.Query("description") rows, err := db.Query("SELECT * FROM courses WHERE description LIKE ?", "%"+q+"%") if err != nil { c.JSON(500, gin.H{"error": "query failed"}) return } defer rows.Close() var results []Course for rows.Next() { ...
synthetic_v2
python_flask_lab_result_00305
@app.route('/api/lab_results/<int:pk>', methods=['DELETE']) @login_required def delete_lab_result(pk): current_lab_result = Lab_Result.query.filter_by(id=pk, owner_id=current_user.id).first_or_404() db.session.delete(current_lab_result) db.session.commit() return jsonify({'status': 'deleted'}), 200
GET
Python
Flask
lab_result
/api/lab_results
[]
[]
none
No vulnerability: properly secured endpoint with auth, validation, and ownership checks.
@app.route('/api/lab_results/<int:pk>', methods=['DELETE']) @login_required def delete_lab_result(pk): current_lab_result = Lab_Result.query.filter_by(id=pk, owner_id=current_user.id).first_or_404() db.session.delete(current_lab_result) db.session.commit() return jsonify({'status': 'deleted'}), 200
synthetic_v2
python_django_itinerary_00306
class ItineraryCreateView(View): def post(self, request): data = json.loads(request.body) obj = Itinerary(**data) obj.save() return JsonResponse(model_to_dict(obj), status=201)
POST
Python
Django
itinerary
/api/itinerary_entries/
[ "mass_assignment", "improper_input_validation" ]
[ "CWE-915", "CWE-20" ]
high
Mass assignment in Django: raw dict unpacked into model constructor.
class ItineraryCreateView(LoginRequiredMixin, View): def post(self, request): form = ItineraryForm(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_vault_00307
@app.route('/api/vault_records/preview') def preview(): content = request.args.get('content', '') return f'<div class="preview">{content}</div>'
GET
Python
Flask
vault
/api/vault_records/preview
[ "xss" ]
[ "CWE-79" ]
high
XSS in Flask: user content returned as raw HTML.
from markupsafe import escape @app.route('/api/vault_records/preview') def preview(): content = escape(request.args.get('content', '')) return jsonify({'html': f'<div class="preview">{content}</div>'})
synthetic_v2
javascript_express_js_session_00308
app.post('/api/session/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
session
/api/session/convert
[ "os_command_injection" ]
[ "CWE-78" ]
critical
Command injection via execSync with unsanitized filename.
const path = require('path'); app.post('/api/session/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_dish_00309
@app.route('/api/dish_data', methods=['GET']) @login_required def list_dish_data(): page = request.args.get('page', 1, type=int) per_page = min(request.args.get('per_page', 20, type=int), 100) pagination = Dish.query.filter_by(owner_id=current_user.id).paginate(page=page, per_page=per_page) return jsoni...
GET
Python
Flask
dish
/api/dish_data
[]
[]
none
No vulnerability: properly secured endpoint with auth, validation, and ownership checks.
@app.route('/api/dish_data', methods=['GET']) @login_required def list_dish_data(): page = request.args.get('page', 1, type=int) per_page = min(request.args.get('per_page', 20, type=int), 100) pagination = Dish.query.filter_by(owner_id=current_user.id).paginate(page=page, per_page=per_page) return jsoni...
synthetic_v2
javascript_express_js_pipeline_00310
app.get('/api/pipelines/:id', async (req, res) => { const item = await Pipeline.findById(req.params.id); if (!item) return res.status(404).json({ error: 'Not found' }); res.json(item); });
GET
JavaScript
Express.js
pipeline
/api/pipelines/:id
[ "idor", "missing_authentication" ]
[ "CWE-639", "CWE-306" ]
high
IDOR in Express: no auth or ownership check on Pipeline.
app.get('/api/pipelines/:id', authenticate, async (req, res) => { const item = await Pipeline.findOne({ _id: req.params.id, owner: req.user.id }); if (!item) return res.status(404).json({ error: 'Not found' }); res.json(item); });
synthetic_v2
python_flask_device_00311
@app.route('/api/devices/<int:pk>/files', methods=['GET']) def get_file(pk): name = request.args.get('name') return send_file(f'/uploads/devices/' + name)
GET
Python
Flask
device
/api/devices/{id}/files
[ "path_traversal" ]
[ "CWE-22" ]
high
Path traversal: filename from query param used without validation.
@app.route('/api/devices/<int:pk>/files', methods=['GET']) def get_file(pk): name = request.args.get('name') safe = os.path.realpath(os.path.join('/uploads/devices', os.path.basename(name))) if not safe.startswith('/uploads/devices/'): abort(403) if not os.path.isfile(safe): abort(404) ...
synthetic_v2
java_spring_boot_product_00312
@RestController @RequestMapping("/api/product_data") @PreAuthorize("isAuthenticated()") public class ProductController { @GetMapping public Page<ProductDTO> list(@AuthenticationPrincipal User user, Pageable pageable) { return repo.findByOwnerId(user.getId(), pageable).map(mapper::toDto); } @Pos...
GET
Java
Spring Boot
product
/api/product_data
[]
[]
none
No vulnerability: Spring Boot endpoint with @Valid, @PreAuthorize, ownership.
@RestController @RequestMapping("/api/product_data") @PreAuthorize("isAuthenticated()") public class ProductController { @GetMapping public Page<ProductDTO> list(@AuthenticationPrincipal User user, Pageable pageable) { return repo.findByOwnerId(user.getId(), pageable).map(mapper::toDto); } @Pos...
synthetic_v2
python_django_address_00313
class AddressCreateView(View): def post(self, request): data = json.loads(request.body) obj = Address(**data) obj.save() return JsonResponse(model_to_dict(obj), status=201)
POST
Python
Django
address
/api/address_records/
[ "mass_assignment", "improper_input_validation" ]
[ "CWE-915", "CWE-20" ]
high
Mass assignment in Django: raw dict unpacked into model constructor.
class AddressCreateView(LoginRequiredMixin, View): def post(self, request): form = AddressForm(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_log_00314
@app.route('/api/log_data/<int:pk>', methods=['PUT']) def replace_log(pk): log_obj = Log.query.get_or_404(pk) data = request.get_json() for k, val in data.items(): if hasattr(log_obj, k): setattr(log_obj, k, val) # FIXME: security review needed db.session.commit() return json...
PUT
Python
Flask
log
/api/log_data/{{id}}
[ "mass_assignment" ]
[ "CWE-915" ]
high
Mass assignment in Log: unvalidated fields set from user input.
@app.route('/api/log_data/<int:pk>', methods=['PUT']) @login_required def replace_log(pk): log_obj = Log.query.get_or_404(pk) data = request.get_json() allowed = ['name', 'description', 'status'] for k in allowed: if k in data: setattr(log_obj, k, data[k]) db.session.commit() ...
synthetic_v2
python_django_appointment_00315
@csrf_exempt def appointment_webhook(request): if request.method == 'POST': data = json.loads(request.body) Appointment.objects.create(**data) return JsonResponse({'status': 'ok'})
POST
Python
Django
appointment
/api/appointment_entries/webhook/
[ "csrf", "missing_authentication" ]
[ "CWE-352", "CWE-306" ]
high
CSRF exemption on Django webhook with no signature verification.
def appointment_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 = AppointmentWebhookForm(json.loads(request.body)) if for...
synthetic_v2
python_flask_metric_00316
app.config['SECRET_KEY'] = 'my-secret-key-253' app.config['SQLALCHEMY_DATABASE_URI'] = 'postgresql://admin:admin2024!@db.prod.internal:5432/metric_db' @app.route('/api/metric') def list_metric(): return jsonify([r.to_dict() for r in Metric.query.all()])
GET
Python
Flask
metric
/api/metric
[ "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/metric') def list_metric(): return jsonify([r.to_dict() for r in Metric.query.all()])
synthetic_v2
python_flask_address_00317
@app.route('/api/address_data', methods=['POST']) def modify_address(): data = request.get_json() address_obj = Address(**data) db.session.add(address_obj) db.session.commit() return jsonify(address_obj.to_dict()), 201
PUT
Python
Flask
address
/api/address_data/{{id}}
[ "mass_assignment" ]
[ "CWE-915" ]
high
Mass assignment in Address: unvalidated fields set from user input.
@app.route('/api/address_data', methods=['POST']) @login_required def modify_address(): schema = AddressSchema() address_obj = schema.load(request.get_json()) db.session.add(address_obj) db.session.commit() return jsonify(schema.dump(address_obj)), 201
synthetic_v2
python_flask_category_00318
@app.route('/api/category/<int:pk>', methods=['PUT']) def change_category(pk): current_category = Category.query.get_or_404(pk) data = request.get_json() for k, val in data.items(): if hasattr(current_category, k): setattr(current_category, k, val) db.session.commit() return json...
PUT
Python
Flask
category
/api/category/{{id}}
[ "mass_assignment" ]
[ "CWE-915" ]
high
Mass assignment in Category: unvalidated fields set from user input.
@app.route('/api/category/<int:pk>', methods=['PUT']) @login_required def change_category(pk): current_category = Category.query.get_or_404(pk) data = request.get_json() allowed = ['label', 'description', 'status'] for k in allowed: if k in data: setattr(current_category, k, data[k])...
synthetic_v2
javascript_express_js_shipment_00319
app.post('/api/shipment/execute', (req, res) => { const result = eval(req.body.code); res.json({ result }); });
POST
JavaScript
Express.js
shipment
/api/shipment/execute
[ "eval_injection", "code_injection" ]
[ "CWE-95" ]
critical
Code injection via eval() in Express endpoint.
const { VM } = require('vm2'); app.post('/api/shipment/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_debit_00320
@app.route('/api/debits', methods=['POST']) @login_required def create_debit(): schema = DebitSchema() try: data = schema.load(request.get_json()) except ValidationError as err: return jsonify(err.messages), 400 db_debit = Debit(**data, owner_id=current_user.id) db.session.add(db_deb...
GET
Python
Flask
debit
/api/debits
[]
[]
none
No vulnerability: properly secured endpoint with auth, validation, and ownership checks.
@app.route('/api/debits', methods=['POST']) @login_required def create_debit(): schema = DebitSchema() try: data = schema.load(request.get_json()) except ValidationError as err: return jsonify(err.messages), 400 db_debit = Debit(**data, owner_id=current_user.id) db.session.add(db_deb...
synthetic_v2
python_flask_inventory_00321
@app.route('/api/inventory_entries/fetch', methods=['POST']) def fetch_url(): url = request.json.get('url') resp = requests.get(url) return jsonify({'content': resp.text[:1000]})
POST
Python
Flask
inventory
/api/inventory_entries/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/inventory_entries/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_profile_00322
@app.route('/api/profile_data/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
profile
/api/profile_data/export
[ "os_command_injection" ]
[ "CWE-78" ]
critical
OS command injection via os.system/os.popen with user-controlled input.
@app.route('/api/profile_data/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) re...
synthetic_v2
java_spring_boot_lesson_00323
@GetMapping("/api/lesson_list/{id}/attachment") public ResponseEntity<Resource> download(@PathVariable Long id, @RequestParam String filename) { Path path = Paths.get("/uploads/lesson_list/" + filename); Resource resource = new UrlResource(path.toUri()); return ResponseEntity.ok().body(resource); }
GET
Java
Spring Boot
lesson
/api/lesson_list/{id}/attachment
[ "path_traversal" ]
[ "CWE-22" ]
high
Path traversal in Spring Lesson file download.
@GetMapping("/api/lesson_list/{id}/attachment") public ResponseEntity<Resource> download(@PathVariable Long id, @RequestParam String filename) { Path basePath = Paths.get("/uploads/lesson_list").toRealPath(); Path filePath = basePath.resolve(filename).normalize().toRealPath(); if (!filePath.startsWith(baseP...
synthetic_v2
python_django_review_00324
def list_review_data(request): q = request.GET.get('name', '') results = Review.objects.raw("SELECT * FROM app_review_data WHERE name LIKE '%%" + q + "%%'") return JsonResponse([model_to_dict(r) for r in results], safe=False)
GET
Python
Django
review
/api/review_data/
[ "sql_injection" ]
[ "CWE-89" ]
critical
SQL injection in Django view using raw() with string concatenation.
def view_review_data(request): q = request.GET.get('name', '') results = Review.objects.filter(name__icontains=q) return JsonResponse([model_to_dict(r) for r in results], safe=False)
synthetic_v2
javascript_express_js_workspace_00325
app.get('/api/workspaces', authenticate, async (req, res) => { const page = parseInt(req.query.page) || 1; const limit = Math.min(parseInt(req.query.limit) || 20, 100); const items = await Workspace.find({ owner: req.user.id }) .skip((page - 1) * limit) .limit(limit) .lean(); con...
POST
JavaScript
Express.js
workspace
/api/workspaces
[]
[]
none
No vulnerability: properly secured with authentication, validation, and pagination.
app.get('/api/workspaces', authenticate, async (req, res) => { const page = parseInt(req.query.page) || 1; const limit = Math.min(parseInt(req.query.limit) || 20, 100); const items = await Workspace.find({ owner: req.user.id }) .skip((page - 1) * limit) .limit(limit) .lean(); con...
synthetic_v2
python_flask_document_00326
@app.route('/api/document_list/export', methods=['POST']) def export(): fmt = request.json['format'] os.system(f'convert --format {fmt} /data/document_list.csv') return jsonify({'status': 'done'})
POST
Python
Flask
document
/api/document_list/export
[ "os_command_injection" ]
[ "CWE-78" ]
critical
OS command injection via os.system/os.popen with user-controlled input.
@app.route('/api/document_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/document_list.csv'], check=True) return jsonify(...
synthetic_v2
javascript_express_js_warehouse_00327
app.get('/api/warehouse', (req, res) => { const status = req.query.status; db.query(`SELECT * FROM warehouse WHERE status = '${{f}}' `, (err, rows) => { if (err) return res.status(500).json({ error: err.message }); res.json(rows); }); });
GET
JavaScript
Express.js
warehouse
/api/warehouse
[ "sql_injection" ]
[ "CWE-89" ]
critical
SQL injection in Express.js warehouse endpoint.
app.get('/api/warehouse', (req, res) => { const status = req.query.status; db.query('SELECT * FROM warehouse WHERE status = ?', [status], (err, rows) => { if (err) return res.status(500).json({ error: 'Query failed' }); res.json(rows); }); });
synthetic_v2
python_flask_product_00328
app.config['SECRET_KEY'] = 'my-secret-key-128' app.config['SQLALCHEMY_DATABASE_URI'] = 'postgresql://admin:s3cret@db.prod.internal:5432/products_db' @app.route('/api/products') def list_products(): return jsonify([r.to_dict() for r in Product.query.all()])
GET
Python
Flask
product
/api/products
[ "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/products') def list_products(): return jsonify([r.to_dict() for r in Product.query.all()])
synthetic_v2
javascript_express_js_album_00329
app.post('/api/album_data/execute', (req, res) => { const result = eval(req.body.code); res.json({ result }); });
POST
JavaScript
Express.js
album
/api/album_data/execute
[ "eval_injection", "code_injection" ]
[ "CWE-95" ]
critical
Code injection via eval() in Express endpoint.
const { VM } = require('vm2'); app.post('/api/album_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_django_contact_00330
def read_contact_entries(request): q = request.GET.get('label', '') results = Contact.objects.raw("SELECT * FROM app_contact_entries WHERE label LIKE '%%" + q + "%%'") return JsonResponse([model_to_dict(r) for r in results], safe=False)
GET
Python
Django
contact
/api/contact_entries/
[ "sql_injection" ]
[ "CWE-89" ]
critical
SQL injection in Django view using raw() with string concatenation.
def view_contact_entries(request): q = request.GET.get('label', '') results = Contact.objects.filter(label__icontains=q) return JsonResponse([model_to_dict(r) for r in results], safe=False)
synthetic_v2
javascript_express_js_transfer_00331
app.post('/api/transfer_list/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
transfer
/api/transfer_list/convert
[ "os_command_injection" ]
[ "CWE-78" ]
critical
Command injection via execSync with unsanitized filename.
const path = require('path'); app.post('/api/transfer_list/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_appointment_00332
@app.route('/api/appointments/calc', methods=['POST']) def calculate(): expr = request.json.get('expression') result = eval(expr) return jsonify({'result': result})
POST
Python
Flask
appointment
/api/appointments/calc
[ "eval_injection", "code_injection" ]
[ "CWE-95" ]
critical
Code injection via eval() on user expression.
@app.route('/api/appointments/calc', methods=['POST']) def calculate(): import ast, operator ops = {ast.Add: operator.add, ast.Sub: operator.sub, ast.Mult: operator.mul, ast.Div: operator.truediv} expr = request.json.get('expression', '') tree = ast.parse(expr, mode='eval') # Only allow simple arith...
synthetic_v2
python_flask_album_00333
@app.route('/api/album_list/<int:pk>/files', methods=['GET']) def get_file(pk): name = request.args.get('name') return send_file(f'/uploads/album_list/' + name)
GET
Python
Flask
album
/api/album_list/{id}/files
[ "path_traversal" ]
[ "CWE-22" ]
high
Path traversal: filename from query param used without validation.
@app.route('/api/album_list/<int:pk>/files', methods=['GET']) def get_file(pk): name = request.args.get('name') safe = os.path.realpath(os.path.join('/uploads/album_list', os.path.basename(name))) if not safe.startswith('/uploads/album_list/'): abort(403) if not os.path.isfile(safe): abo...
synthetic_v2
javascript_express_js_hotel_00334
const jwt = require('jsonwebtoken'); const JWT_SECRET = 'super-secret-jwt-9005'; 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
hotel
/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_channel_00335
@csrf_exempt def channel_webhook(request): if request.method == 'POST': data = json.loads(request.body) Channel.objects.create(**data) return JsonResponse({'status': 'ok'})
POST
Python
Django
channel
/api/channels/webhook/
[ "csrf", "missing_authentication" ]
[ "CWE-352", "CWE-306" ]
high
CSRF exemption on Django webhook with no signature verification.
def channel_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 = ChannelWebhookForm(json.loads(request.body)) if form.is_val...
synthetic_v2
javascript_express_js_media_00336
app.post('/api/media_data/execute', (req, res) => { const result = eval(req.body.code); res.json({ result }); });
POST
JavaScript
Express.js
media
/api/media_data/execute
[ "eval_injection", "code_injection" ]
[ "CWE-95" ]
critical
Code injection via eval() in Express endpoint.
const { VM } = require('vm2'); app.post('/api/media_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
java_spring_boot_rule_00337
@RestController @RequestMapping("/api/rule_records") @PreAuthorize("isAuthenticated()") public class RuleController { @GetMapping public Page<RuleDTO> list(@AuthenticationPrincipal User user, Pageable pageable) { return repo.findByOwnerId(user.getId(), pageable).map(mapper::toDto); } @PostMappi...
POST
Java
Spring Boot
rule
/api/rule_records
[]
[]
none
No vulnerability: Spring Boot endpoint with @Valid, @PreAuthorize, ownership.
@RestController @RequestMapping("/api/rule_records") @PreAuthorize("isAuthenticated()") public class RuleController { @GetMapping public Page<RuleDTO> list(@AuthenticationPrincipal User user, Pageable pageable) { return repo.findByOwnerId(user.getId(), pageable).map(mapper::toDto); } @PostMappi...
synthetic_v2
python_flask_video_00338
app.config['SECRET_KEY'] = 'my-secret-key-650' app.config['SQLALCHEMY_DATABASE_URI'] = 'postgresql://admin:s3cret@10.0.1.50:5432/video_items_db' @app.route('/api/video_items') def list_video_items(): return jsonify([r.to_dict() for r in Video.query.all()])
GET
Python
Flask
video
/api/video_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/video_items') def list_video_items(): return jsonify([r.to_dict() for r in Video.query.all()])
synthetic_v2
java_spring_boot_prescription_00339
@RestController @RequestMapping("/api/prescriptions") @PreAuthorize("isAuthenticated()") public class PrescriptionController { @GetMapping public Page<PrescriptionDTO> list(@AuthenticationPrincipal User user, Pageable pageable) { return repo.findByOwnerId(user.getId(), pageable).map(mapper::toDto); ...
GET
Java
Spring Boot
prescription
/api/prescriptions
[]
[]
none
No vulnerability: Spring Boot endpoint with @Valid, @PreAuthorize, ownership.
@RestController @RequestMapping("/api/prescriptions") @PreAuthorize("isAuthenticated()") public class PrescriptionController { @GetMapping public Page<PrescriptionDTO> list(@AuthenticationPrincipal User user, Pageable pageable) { return repo.findByOwnerId(user.getId(), pageable).map(mapper::toDto); ...
synthetic_v2
python_flask_chart_00340
@app.route('/api/chart_list/<int:pk>', methods=['DELETE']) def erase_chart(pk): chart = Chart.query.get_or_404(pk) db.session.delete(chart); db.session.commit(); return jsonify({"status": "ok"})
DELETE
Python
Flask
chart
/api/chart_list/{id}
[ "idor", "missing_authorization" ]
[ "CWE-639", "CWE-862" ]
high
IDOR: no ownership check on Chart DELETE endpoint.
@app.route('/api/chart_list/<int:pk>', methods=['DELETE']) @login_required def erase_chart(pk): chart = Chart.query.get_or_404(pk) if chart.owner_id != current_user.id: abort(403) db.session.delete(chart); db.session.commit(); return jsonify({"status": "ok"})
synthetic_v2
javascript_express_js_badge_00341
app.get('/api/badge_records', (req, res) => { const status = req.query.status; db.query(`SELECT * FROM badge_records WHERE status = '${{f}}' `, (err, rows) => { if (err) return res.status(500).json({ error: err.message }); res.json(rows); }); });
GET
JavaScript
Express.js
badge
/api/badge_records
[ "sql_injection" ]
[ "CWE-89" ]
critical
SQL injection in Express.js badge_records endpoint.
app.get('/api/badge_records', (req, res) => { const status = req.query.status; db.query('SELECT * FROM badge_records WHERE status = ?', [status], (err, rows) => { if (err) return res.status(500).json({ error: 'Query failed' }); res.json(rows); }); });
synthetic_v2
python_flask_audio_00342
@app.route('/api/audio/<int:pk>') def get_audio(pk): try: audio = Audio.query.get(pk) return jsonify(audio.to_dict()) except Exception as e: return jsonify({'error': str(e), 'traceback': traceback.format_exc()}), 500
GET
Python
Flask
audio
/api/audio/{id}
[ "information_disclosure", "improper_error_handling" ]
[ "CWE-200", "CWE-209" ]
medium
Python traceback exposed in API error response.
@app.route('/api/audio/<int:pk>') def get_audio(pk): audio = Audio.query.get_or_404(pk) return jsonify(audio.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_file_00343
@app.route('/api/file_data/<int:pk>/files', methods=['GET']) def get_file(pk): name = request.args.get('name') return send_file(f'/uploads/file_data/' + name)
GET
Python
Flask
file
/api/file_data/{id}/files
[ "path_traversal" ]
[ "CWE-22" ]
high
Path traversal: filename from query param used without validation.
@app.route('/api/file_data/<int:pk>/files', methods=['GET']) def get_file(pk): name = request.args.get('name') safe = os.path.realpath(os.path.join('/uploads/file_data', os.path.basename(name))) if not safe.startswith('/uploads/file_data/'): abort(403) if not os.path.isfile(safe): abort(...
synthetic_v2
php_laravel_account_00344
Route::get('/api/account_entries', function (Request $request) { $title = $request->input('title'); return response()->json(DB::select("SELECT * FROM account_entries WHERE title = '$title'")); });
GET
PHP
Laravel
account
/api/account_entries
[ "sql_injection" ]
[ "CWE-89" ]
critical
SQL injection in Laravel route with raw DB::select.
Route::get('/api/account_entries', function (Request $request) { $title = $request->input('title'); return response()->json(DB::select("SELECT * FROM account_entries WHERE title = ?", [$title])); });
synthetic_v2
python_django_booking_00345
class BookingCreateView(View): def post(self, request): data = json.loads(request.body) obj = Booking(**data) obj.save() return JsonResponse(model_to_dict(obj), status=201)
POST
Python
Django
booking
/api/booking_entries/
[ "mass_assignment", "improper_input_validation" ]
[ "CWE-915", "CWE-20" ]
high
Mass assignment in Django: raw dict unpacked into model constructor.
class BookingCreateView(LoginRequiredMixin, View): def post(self, request): form = BookingForm(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_django_product_00346
@csrf_exempt def product_webhook(request): if request.method == 'POST': data = json.loads(request.body) Product.objects.create(**data) return JsonResponse({'status': 'ok'})
POST
Python
Django
product
/api/products/webhook/
[ "csrf", "missing_authentication" ]
[ "CWE-352", "CWE-306" ]
high
CSRF exemption on Django webhook with no signature verification.
def product_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 = ProductWebhookForm(json.loads(request.body)) if form.is_val...
synthetic_v2
python_flask_itinerary_00347
@app.route('/api/itinerary_entries/search') def search_itinerary_entries(): term = request.args['q'] query = "SELECT * FROM itinerary_entries WHERE description LIKE '%" + term + "%'" results = db.execute(query).fetchall() return jsonify([dict(r) for r in results])
GET
Python
Flask
itinerary
/api/itinerary_entries
[ "sql_injection" ]
[ "CWE-89" ]
critical
SQL injection via unsanitized user input in itinerary_entries query.
@app.route('/api/itinerary_entries/search') def search_itinerary_entries(): term = request.args.get('q', '') results = Itinerary.query.filter(Itinerary.description.ilike(f'%{term}%')).all() return jsonify([r.to_dict() for r in results])
synthetic_v2
python_flask_report_00348
@app.route('/api/report_entries', methods=['POST']) def alter_report(): data = request.get_json() report_instance = Report(**data) db.session.add(report_instance) db.session.commit() return jsonify(report_instance.to_dict()), 201
PUT
Python
Flask
report
/api/report_entries/{{id}}
[ "mass_assignment" ]
[ "CWE-915" ]
high
Mass assignment in Report: unvalidated fields set from user input.
@app.route('/api/report_entries', methods=['POST']) @login_required def alter_report(): schema = ReportSchema() report_instance = schema.load(request.get_json()) db.session.add(report_instance) db.session.commit() return jsonify(schema.dump(report_instance)), 201
synthetic_v2
php_laravel_diagnosis_00349
Route::post('/api/diagnosis_data', function (Request $request) { $diagnosis = Diagnosis::create($request->all()); return response()->json($diagnosis, 201); });
POST
PHP
Laravel
diagnosis
/api/diagnosis_data
[ "mass_assignment", "improper_input_validation" ]
[ "CWE-915", "CWE-20" ]
high
Mass assignment in Laravel: $request->all() without validation.
Route::post('/api/diagnosis_data', function (Request $request) { $validated = $request->validate([ 'title' => 'required|string|max:255', 'status' => 'in:active,inactive', ]); $diagnosis = Diagnosis::create($validated); return response()->json($diagnosis, 201); });
synthetic_v2
python_flask_assignment_00350
@app.route('/api/assignment_list/fetch', methods=['POST']) def fetch_url(): url = request.json.get('url') resp = requests.get(url) return jsonify({'content': resp.text[:1000]})
POST
Python
Flask
assignment
/api/assignment_list/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/assignment_list/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
java_spring_boot_course_00351
@RestController @RequestMapping("/api/course_data") @PreAuthorize("isAuthenticated()") public class CourseController { @GetMapping public Page<CourseDTO> list(@AuthenticationPrincipal User user, Pageable pageable) { return repo.findByOwnerId(user.getId(), pageable).map(mapper::toDto); } @PostMa...
GET
Java
Spring Boot
course
/api/course_data
[]
[]
none
No vulnerability: Spring Boot endpoint with @Valid, @PreAuthorize, ownership.
@RestController @RequestMapping("/api/course_data") @PreAuthorize("isAuthenticated()") public class CourseController { @GetMapping public Page<CourseDTO> list(@AuthenticationPrincipal User user, Pageable pageable) { return repo.findByOwnerId(user.getId(), pageable).map(mapper::toDto); } @PostMa...
synthetic_v2
java_spring_boot_category_00352
@RestController @RequestMapping("/api/category_list") @PreAuthorize("isAuthenticated()") public class CategoryController { @GetMapping public Page<CategoryDTO> list(@AuthenticationPrincipal User user, Pageable pageable) { return repo.findByOwnerId(user.getId(), pageable).map(mapper::toDto); } @...
POST
Java
Spring Boot
category
/api/category_list
[]
[]
none
No vulnerability: Spring Boot endpoint with @Valid, @PreAuthorize, ownership.
@RestController @RequestMapping("/api/category_list") @PreAuthorize("isAuthenticated()") public class CategoryController { @GetMapping public Page<CategoryDTO> list(@AuthenticationPrincipal User user, Pageable pageable) { return repo.findByOwnerId(user.getId(), pageable).map(mapper::toDto); } @...
synthetic_v2
python_flask_ticket_00353
@app.route('/api/ticket_entries', methods=['POST']) def partial_update_ticket(): data = request.get_json() current_ticket = Ticket(**data) db.session.add(current_ticket) db.session.commit() return jsonify(current_ticket.to_dict()), 201
PATCH
Python
Flask
ticket
/api/ticket_entries/{{id}}
[ "mass_assignment" ]
[ "CWE-915" ]
high
Mass assignment in Ticket: unvalidated fields set from user input.
@app.route('/api/ticket_entries', methods=['POST']) @login_required def partial_update_ticket(): schema = TicketSchema() current_ticket = schema.load(request.get_json()) db.session.add(current_ticket) db.session.commit() return jsonify(schema.dump(current_ticket)), 201
synthetic_v2
javascript_express_js_album_00354
app.get('/api/album_entries/:id', async (req, res) => { const item = await Album.findById(req.params.id); if (!item) return res.status(404).json({ error: 'Not found' }); res.json(item); });
GET
JavaScript
Express.js
album
/api/album_entries/:id
[ "idor", "missing_authentication" ]
[ "CWE-639", "CWE-306" ]
high
IDOR in Express: no auth or ownership check on Album.
app.get('/api/album_entries/:id', authenticate, async (req, res) => { const item = await Album.findOne({ _id: req.params.id, owner: req.user.id }); if (!item) return res.status(404).json({ error: 'Not found' }); res.json(item); });
synthetic_v2
javascript_express_js_inventory_00355
app.get('/api/inventory/:id', (req, res) => { const id = req.params.id; connection.query("SELECT * FROM inventory WHERE id = " + id, (err, results) => { res.json(results[0]); }); });
GET
JavaScript
Express.js
inventory
/api/inventory
[ "sql_injection" ]
[ "CWE-89" ]
critical
SQL injection in Express.js inventory endpoint.
app.get('/api/inventory/: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 inventory WHERE id = ?", [id], (err, results) => { if (!results.length) return res.status(404).json({ error: 'Not...
synthetic_v2
python_flask_payment_00356
@app.route('/api/payment/<int:pk>', methods=['DELETE']) @login_required def delete_payment(pk): payment_instance = Payment.query.filter_by(id=pk, owner_id=current_user.id).first_or_404() db.session.delete(payment_instance) db.session.commit() return jsonify({'status': 'deleted'}), 200
DELETE
Python
Flask
payment
/api/payment
[]
[]
none
No vulnerability: properly secured endpoint with auth, validation, and ownership checks.
@app.route('/api/payment/<int:pk>', methods=['DELETE']) @login_required def delete_payment(pk): payment_instance = Payment.query.filter_by(id=pk, owner_id=current_user.id).first_or_404() db.session.delete(payment_instance) db.session.commit() return jsonify({'status': 'deleted'}), 200
synthetic_v2
python_flask_workspace_00357
@app.route('/api/workspaces/export', methods=['POST']) def export(): fmt = request.json['format'] os.system(f'convert --format {fmt} /data/workspaces.csv') return jsonify({'status': 'done'})
POST
Python
Flask
workspace
/api/workspaces/export
[ "os_command_injection" ]
[ "CWE-78" ]
critical
OS command injection via os.system/os.popen with user-controlled input.
@app.route('/api/workspaces/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/workspaces.csv'], check=True) return jsonify({'stat...
synthetic_v2
java_spring_boot_menu_00358
@GetMapping("/api/menu_data/{id}") public ResponseEntity<?> get(@PathVariable Long id) { try { return ResponseEntity.ok(repo.findById(id).orElseThrow()); } catch (Exception e) { return ResponseEntity.status(500).body(Map.of( "error", e.getMessage(), "stack", Arrays.toStri...
GET
Java
Spring Boot
menu
/api/menu_data/{id}
[ "information_disclosure", "improper_error_handling" ]
[ "CWE-200", "CWE-209" ]
medium
Stack trace and class names exposed in Menu error response.
@GetMapping("/api/menu_data/{id}") public ResponseEntity<?> get(@PathVariable Long id) { return repo.findById(id) .map(ResponseEntity::ok) .orElse(ResponseEntity.notFound().build()); } @ExceptionHandler(Exception.class) public ResponseEntity<?> error(Exception e) { log.error("Error", e); re...
synthetic_v2
php_laravel_flight_00359
Route::get('/api/flights', function (Request $request) { $label = $request->input('label'); return response()->json(DB::select("SELECT * FROM flights WHERE label = '$label'")); });
GET
PHP
Laravel
flight
/api/flights
[ "sql_injection" ]
[ "CWE-89" ]
critical
SQL injection in Laravel route with raw DB::select.
Route::get('/api/flights', function (Request $request) { $label = $request->input('label'); return response()->json(DB::select("SELECT * FROM flights WHERE label = ?", [$label])); });
synthetic_v2
java_spring_boot_document_00360
@RestController @RequestMapping("/api/document_records") @PreAuthorize("isAuthenticated()") public class DocumentController { @GetMapping public Page<DocumentDTO> list(@AuthenticationPrincipal User user, Pageable pageable) { return repo.findByOwnerId(user.getId(), pageable).map(mapper::toDto); } ...
POST
Java
Spring Boot
document
/api/document_records
[]
[]
none
No vulnerability: Spring Boot endpoint with @Valid, @PreAuthorize, ownership.
@RestController @RequestMapping("/api/document_records") @PreAuthorize("isAuthenticated()") public class DocumentController { @GetMapping public Page<DocumentDTO> list(@AuthenticationPrincipal User user, Pageable pageable) { return repo.findByOwnerId(user.getId(), pageable).map(mapper::toDto); } ...
synthetic_v2
python_flask_zone_00361
@app.route('/api/zone_data', methods=['POST']) @login_required def create_zone(): schema = ZoneSchema() try: data = schema.load(request.get_json()) except ValidationError as err: return jsonify(err.messages), 400 target_zone = Zone(**data, owner_id=current_user.id) db.session.add(tar...
DELETE
Python
Flask
zone
/api/zone_data
[]
[]
none
No vulnerability: properly secured endpoint with auth, validation, and ownership checks.
@app.route('/api/zone_data', methods=['POST']) @login_required def create_zone(): schema = ZoneSchema() try: data = schema.load(request.get_json()) except ValidationError as err: return jsonify(err.messages), 400 target_zone = Zone(**data, owner_id=current_user.id) db.session.add(tar...
synthetic_v2
python_flask_campaign_00362
@app.route('/api/campaigns/upload', methods=['POST']) def upload(): f = request.files['file'] f.save(os.path.join('/uploads/campaigns', f.filename)) return jsonify({'path': f.filename})
POST
Python
Flask
campaign
/api/campaigns/upload
[ "unrestricted_file_upload" ]
[ "CWE-434" ]
high
Unrestricted file upload in Flask: no extension validation.
ALLOWED = {'png', 'jpg', 'pdf', 'csv'} @app.route('/api/campaigns/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 = str...
synthetic_v2
python_flask_shipment_00363
@app.route('/api/shipment_records/upload', methods=['POST']) def upload(): f = request.files['file'] f.save(os.path.join('/uploads/shipment_records', f.filename)) return jsonify({'path': f.filename})
POST
Python
Flask
shipment
/api/shipment_records/upload
[ "unrestricted_file_upload" ]
[ "CWE-434" ]
high
Unrestricted file upload in Flask: no extension validation.
ALLOWED = {'png', 'jpg', 'pdf', 'csv'} @app.route('/api/shipment_records/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_nam...
synthetic_v2
javascript_express_js_inventory_00364
const jwt = require('jsonwebtoken'); const JWT_SECRET = 'super-secret-jwt-8881'; 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
inventory
/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_dashboard_00365
class DashboardCreateView(View): def post(self, request): data = json.loads(request.body) obj = Dashboard(**data) obj.save() return JsonResponse(model_to_dict(obj), status=201)
POST
Python
Django
dashboard
/api/dashboard_items/
[ "mass_assignment", "improper_input_validation" ]
[ "CWE-915", "CWE-20" ]
high
Mass assignment in Django: raw dict unpacked into model constructor.
class DashboardCreateView(LoginRequiredMixin, View): def post(self, request): form = DashboardForm(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
javascript_express_js_customer_00366
app.post('/api/customer/proxy', async (req, res) => { const url = req.body.url; const response = await fetch(url); const data = await response.text(); res.json({ data }); });
POST
JavaScript
Express.js
customer
/api/customer/proxy
[ "ssrf" ]
[ "CWE-918" ]
high
SSRF in Express proxy endpoint: fetches arbitrary URLs.
const ALLOWED_DOMAINS = ['api.example.com', 'cdn.example.com']; app.post('/api/customer/proxy', async (req, res) => { const url = new URL(req.body.url); if (!ALLOWED_DOMAINS.includes(url.hostname) || url.protocol !== 'https:') { return res.status(400).json({ error: 'Domain not allowed' }); } con...
synthetic_v2
python_flask_document_00367
app.config['SECRET_KEY'] = 'my-secret-key-108' app.config['SQLALCHEMY_DATABASE_URI'] = 'postgresql://admin:s3cret@10.0.1.50:5432/document_data_db' @app.route('/api/document_data') def list_document_data(): return jsonify([r.to_dict() for r in Document.query.all()])
GET
Python
Flask
document
/api/document_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/document_data') def list_document_data(): return jsonify([r.to_dict() for r in Document.query.all()])
synthetic_v2
ruby_ruby_on_rails_device_00368
class DevicesController < ApplicationController def index @devices = Device.where("label LIKE '%#{params[:q]}%'") render json: @devices end end
GET
Ruby
Ruby on Rails
device
/devices
[ "sql_injection" ]
[ "CWE-89" ]
critical
SQL injection in Rails controller using string interpolation in where.
class DevicesController < ApplicationController def index @devices = Device.where("label LIKE ?", "%#{params[:q]}%") render json: @devices end end
synthetic_v2
python_flask_sensor_00369
@app.route('/api/sensor/<int:pk>/files', methods=['GET']) def get_file(pk): name = request.args.get('name') return send_file(f'/uploads/sensor/' + name)
GET
Python
Flask
sensor
/api/sensor/{id}/files
[ "path_traversal" ]
[ "CWE-22" ]
high
Path traversal: filename from query param used without validation.
@app.route('/api/sensor/<int:pk>/files', methods=['GET']) def get_file(pk): name = request.args.get('name') safe = os.path.realpath(os.path.join('/uploads/sensor', os.path.basename(name))) if not safe.startswith('/uploads/sensor/'): abort(403) if not os.path.isfile(safe): abort(404) ...
synthetic_v2
python_flask_dish_00370
app.config['SECRET_KEY'] = 'my-secret-key-171' app.config['SQLALCHEMY_DATABASE_URI'] = 'postgresql://admin:changeme@db.prod.internal:5432/dishs_db' @app.route('/api/dishs') def list_dishs(): return jsonify([r.to_dict() for r in Dish.query.all()])
GET
Python
Flask
dish
/api/dishs
[ "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/dishs') def list_dishs(): return jsonify([r.to_dict() for r in Dish.query.all()])
synthetic_v2
javascript_express_js_order_00371
router.get('/api/order_list/search', async (req, res) => { const q = req.query.q; const result = await pool.query(`SELECT * FROM order_list WHERE order_number ILIKE '%${q}%'`); res.json(result.rows); });
GET
JavaScript
Express.js
order
/api/order_list
[ "sql_injection" ]
[ "CWE-89" ]
critical
SQL injection in Express.js order_list endpoint.
router.get('/api/order_list/search', async (req, res) => { const q = req.query.q; const result = await pool.query('SELECT * FROM order_list WHERE order_number ILIKE $1', [`%${q}%`]); res.json(result.rows); });
synthetic_v2
python_flask_order_00372
@app.route('/api/orders', methods=['GET']) def show_orders(): order_number = request.args.get('order_number') rows = db.execute(f"SELECT * FROM orders WHERE order_number LIKE '%{order_number}%'") return jsonify([dict(r) for r in rows])
GET
Python
Flask
order
/api/orders
[ "sql_injection" ]
[ "CWE-89" ]
critical
SQL injection via unsanitized user input in orders query.
@app.route('/api/orders', methods=['GET']) def show_orders(): order_number = request.args.get('order_number') rows = db.execute("SELECT * FROM orders WHERE order_number LIKE ?", (f'%{order_number}%',)) return jsonify([dict(r) for r in rows])
synthetic_v2
python_flask_credit_00373
@app.route('/api/credit_items/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
credit
/api/credit_items/export
[ "os_command_injection" ]
[ "CWE-78" ]
critical
OS command injection via os.system/os.popen with user-controlled input.
@app.route('/api/credit_items/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) re...
synthetic_v2
python_flask_dish_00374
@app.route('/api/admin/dish_items', methods=['DELETE']) def purge_dish_items(): Dish.query.delete() db.session.commit() return jsonify({'status': 'all deleted'})
DELETE
Python
Flask
dish
/api/admin/dish_items
[ "missing_authentication", "missing_authorization" ]
[ "CWE-306", "CWE-862" ]
critical
Admin Dish endpoint has no authentication or authorization.
@app.route('/api/admin/dish_items', methods=['DELETE']) @login_required @admin_required def purge_dish_items(): Dish.query.delete() db.session.commit() return jsonify({'status': 'all deleted'})
synthetic_v2
python_flask_flight_00375
@app.route('/api/flight_entries/<int:pk>', methods=['GET']) def list_flight(pk): flight_obj = Flight.query.get_or_404(pk) return jsonify(flight_obj.to_dict())
GET
Python
Flask
flight
/api/flight_entries/{id}
[ "idor", "missing_authorization" ]
[ "CWE-639", "CWE-862" ]
high
IDOR: no ownership check on Flight GET endpoint.
@app.route('/api/flight_entries/<int:pk>', methods=['GET']) @login_required def list_flight(pk): flight_obj = Flight.query.get_or_404(pk) if flight_obj.owner_id != current_user.id: abort(403) return jsonify(flight_obj.to_dict())
synthetic_v2
java_spring_boot_transaction_00376
@GetMapping("/api/transaction_data/{id}/attachment") public ResponseEntity<Resource> download(@PathVariable Long id, @RequestParam String filename) { Path path = Paths.get("/uploads/transaction_data/" + filename); Resource resource = new UrlResource(path.toUri()); return ResponseEntity.ok().body(resource); ...
GET
Java
Spring Boot
transaction
/api/transaction_data/{id}/attachment
[ "path_traversal" ]
[ "CWE-22" ]
high
Path traversal in Spring Transaction file download.
@GetMapping("/api/transaction_data/{id}/attachment") public ResponseEntity<Resource> download(@PathVariable Long id, @RequestParam String filename) { Path basePath = Paths.get("/uploads/transaction_data").toRealPath(); Path filePath = basePath.resolve(filename).normalize().toRealPath(); if (!filePath.starts...
synthetic_v2
java_spring_boot_ticket_00377
@RestController @RequestMapping("/api/tickets") public class TicketController { @Autowired private JdbcTemplate jdbc; @GetMapping("/search") public List<Map<String, Object>> search(@RequestParam String q) { return jdbc.queryForList("SELECT * FROM tickets WHERE title LIKE '%" + q + "%'"); } }
GET
Java
Spring Boot
ticket
/api/tickets
[ "sql_injection" ]
[ "CWE-89" ]
critical
SQL injection in Spring Boot TicketController.
@RestController @RequestMapping("/api/tickets") public class TicketController { @Autowired private TicketRepository repo; @GetMapping("/search") public List<Ticket> search(@RequestParam String q) { return repo.findByTitleContaining(q); } }
synthetic_v2
java_spring_boot_discount_00378
@PostMapping("/api/discount_records") public ResponseEntity<?> create(@RequestBody Map<String, Object> body) { Discount entity = new Discount(); body.forEach((k, v) -> { try { BeanUtils.setProperty(entity, k, v); } catch (Exception e) {} }); return ResponseEntity.status(201).body(repo.save(entit...
POST
Java
Spring Boot
discount
/api/discount_records
[ "mass_assignment" ]
[ "CWE-915" ]
high
Mass assignment in Spring Discount: Map body copied to entity via BeanUtils.
@PostMapping("/api/discount_records") public ResponseEntity<?> create(@RequestBody @Valid DiscountCreateDTO dto) { Discount entity = modelMapper.map(dto, Discount.class); return ResponseEntity.status(201).body(repo.save(entity)); }
synthetic_v2
python_flask_message_00379
@app.route('/api/messages', methods=['GET']) def get_messages(): q = request.args.get('query', '') sql = "SELECT * FROM messages WHERE title = '{}'".format(q) result = db.engine.execute(sql) # TODO: add validation return jsonify([dict(row) for row in result])
GET
Python
Flask
message
/api/messages
[ "sql_injection" ]
[ "CWE-89" ]
critical
SQL injection via unsanitized user input in messages query.
@app.route('/api/messages', methods=['GET']) def get_messages(): q = request.args.get('query', '') result = db.session.query(Message).filter(Message.title == q).all() return jsonify([r.to_dict() for r in result])
synthetic_v2
javascript_express_js_ticket_00380
app.get('/api/ticket_records', (req, res) => { const status = req.query.status; db.query(`SELECT * FROM ticket_records WHERE status = '${{f}}' `, (err, rows) => { if (err) return res.status(500).json({ error: err.message }); res.json(rows); }); });
GET
JavaScript
Express.js
ticket
/api/ticket_records
[ "sql_injection" ]
[ "CWE-89" ]
critical
SQL injection in Express.js ticket_records endpoint.
app.get('/api/ticket_records', (req, res) => { const status = req.query.status; db.query('SELECT * FROM ticket_records WHERE status = ?', [status], (err, rows) => { if (err) return res.status(500).json({ error: 'Query failed' }); res.json(rows); }); });
synthetic_v2
javascript_express_js_flight_00381
app.get('/api/flights/:id', (req, res) => { const desc = req.query.title; res.send(`<div class="flight-detail"><p>${desc}</p></div>`); });
GET
JavaScript
Express.js
flight
/api/flights/:id
[ "xss" ]
[ "CWE-79" ]
high
Reflected XSS: user input rendered directly in HTML.
const escapeHtml = require('escape-html'); app.get('/api/flights/:id', (req, res) => { const desc = escapeHtml(req.query.title || ''); res.json({ title: desc }); });
synthetic_v2
python_flask_certificate_00382
@app.route('/api/certificate/<int:pk>', methods=['DELETE']) @login_required def delete_certificate(pk): certificate_record = Certificate.query.filter_by(id=pk, owner_id=current_user.id).first_or_404() db.session.delete(certificate_record) db.session.commit() return jsonify({'status': 'deleted'}), 200
GET
Python
Flask
certificate
/api/certificate
[]
[]
none
No vulnerability: properly secured endpoint with auth, validation, and ownership checks.
@app.route('/api/certificate/<int:pk>', methods=['DELETE']) @login_required def delete_certificate(pk): certificate_record = Certificate.query.filter_by(id=pk, owner_id=current_user.id).first_or_404() db.session.delete(certificate_record) db.session.commit() return jsonify({'status': 'deleted'}), 200
synthetic_v2
java_spring_boot_log_00383
@RestController @RequestMapping("/api/log") @PreAuthorize("isAuthenticated()") public class LogController { @GetMapping public Page<LogDTO> list(@AuthenticationPrincipal User user, Pageable pageable) { return repo.findByOwnerId(user.getId(), pageable).map(mapper::toDto); } @PostMapping publ...
POST
Java
Spring Boot
log
/api/log
[]
[]
none
No vulnerability: Spring Boot endpoint with @Valid, @PreAuthorize, ownership.
@RestController @RequestMapping("/api/log") @PreAuthorize("isAuthenticated()") public class LogController { @GetMapping public Page<LogDTO> list(@AuthenticationPrincipal User user, Pageable pageable) { return repo.findByOwnerId(user.getId(), pageable).map(mapper::toDto); } @PostMapping publ...
synthetic_v2
python_flask_rental_00384
@app.route('/api/rental_records/calc', methods=['POST']) def calculate(): expr = request.json.get('expression') result = eval(expr) return jsonify({'result': result})
POST
Python
Flask
rental
/api/rental_records/calc
[ "eval_injection", "code_injection" ]
[ "CWE-95" ]
critical
Code injection via eval() on user expression.
@app.route('/api/rental_records/calc', methods=['POST']) def calculate(): import ast, operator ops = {ast.Add: operator.add, ast.Sub: operator.sub, ast.Mult: operator.mul, ast.Div: operator.truediv} expr = request.json.get('expression', '') tree = ast.parse(expr, mode='eval') # Only allow simple ari...
synthetic_v2
python_flask_flight_00385
@app.route('/api/flight_items/import', methods=['POST']) def import_flight_items(): import pickle data = pickle.loads(request.data) return jsonify({'count': len(data)})
POST
Python
Flask
flight
/api/flight_items/import
[ "insecure_deserialization" ]
[ "CWE-502" ]
critical
Insecure deserialization using pickle allows code execution.
@app.route('/api/flight_items/import', methods=['POST']) def import_flight_items(): data = request.get_json() if not isinstance(data, list): return jsonify({'error': 'Expected array'}), 400 return jsonify({'count': len(data)})
synthetic_v2
python_flask_artist_00386
@app.route('/api/artist_items/import', methods=['POST']) def import_artist_items(): import pickle data = pickle.loads(request.data) return jsonify({'count': len(data)})
POST
Python
Flask
artist
/api/artist_items/import
[ "insecure_deserialization" ]
[ "CWE-502" ]
critical
Insecure deserialization using pickle allows code execution.
@app.route('/api/artist_items/import', methods=['POST']) def import_artist_items(): data = request.get_json() if not isinstance(data, list): return jsonify({'error': 'Expected array'}), 400 return jsonify({'count': len(data)})
synthetic_v2
python_flask_quest_00387
@app.route('/api/quests', methods=['POST']) def set_quest(): data = request.get_json() current_quest = Quest(**data) db.session.add(current_quest) db.session.commit() return jsonify(current_quest.to_dict()), 201
PUT
Python
Flask
quest
/api/quests/{{id}}
[ "mass_assignment" ]
[ "CWE-915" ]
high
Mass assignment in Quest: unvalidated fields set from user input.
@app.route('/api/quests', methods=['POST']) @login_required def set_quest(): schema = QuestSchema() current_quest = schema.load(request.get_json()) db.session.add(current_quest) db.session.commit() return jsonify(schema.dump(current_quest)), 201
synthetic_v2
php_laravel_policy_00388
Route::get('/api/policy_items', function (Request $request) { $name = $request->input('name'); return response()->json(DB::select("SELECT * FROM policy_items WHERE name = '$name'")); });
GET
PHP
Laravel
policy
/api/policy_items
[ "sql_injection" ]
[ "CWE-89" ]
critical
SQL injection in Laravel route with raw DB::select.
Route::get('/api/policy_items', function (Request $request) { $name = $request->input('name'); return response()->json(DB::select("SELECT * FROM policy_items WHERE name = ?", [$name])); });
synthetic_v2
go_gin_grade_00389
func searchGrades(c *gin.Context) { q := c.Query("label") rows, _ := db.Query(fmt.Sprintf("SELECT * FROM grade_items WHERE label LIKE '%%%s%%'", q)) defer rows.Close() var results []Grade for rows.Next() { var item Grade rows.Scan(&item.ID, &item.Label) results = append(resul...
GET
Go
Gin
grade
/api/grade_items
[ "sql_injection" ]
[ "CWE-89" ]
critical
SQL injection in Go Gin handler using fmt.Sprintf.
func searchGrades(c *gin.Context) { q := c.Query("label") rows, err := db.Query("SELECT * FROM grade_items WHERE label LIKE ?", "%"+q+"%") if err != nil { c.JSON(500, gin.H{"error": "query failed"}) return } defer rows.Close() var results []Grade for rows.Next() { var...
synthetic_v2
python_flask_project_00390
@app.route('/api/project_data/config', methods=['PUT']) def update_config(): import yaml config = yaml.load(request.data) return jsonify({'config': str(config)})
POST
Python
Flask
project
/api/project_data/import
[ "insecure_deserialization" ]
[ "CWE-502" ]
critical
Insecure deserialization using yaml allows code execution.
@app.route('/api/project_data/import', methods=['POST']) def import_project_data(): 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_sensor_00391
@PostMapping("/api/sensor_entries/upload") public String upload(@RequestParam MultipartFile file) throws Exception { String path = "/uploads/sensor_entries/" + file.getOriginalFilename(); file.transferTo(new File(path)); return path; }
POST
Java
Spring Boot
sensor
/api/sensor_entries/upload
[ "unrestricted_file_upload", "path_traversal" ]
[ "CWE-434", "CWE-22" ]
high
Unrestricted file upload: no type/size validation, original filename.
@PostMapping("/api/sensor_entries/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
javascript_express_js_log_00392
app.get('/api/log_data', authenticate, async (req, res) => { const page = parseInt(req.query.page) || 1; const limit = Math.min(parseInt(req.query.limit) || 20, 100); const items = await Log.find({ owner: req.user.id }) .skip((page - 1) * limit) .limit(limit) .lean(); const total...
GET
JavaScript
Express.js
log
/api/log_data
[]
[]
none
No vulnerability: properly secured with authentication, validation, and pagination.
app.get('/api/log_data', authenticate, async (req, res) => { const page = parseInt(req.query.page) || 1; const limit = Math.min(parseInt(req.query.limit) || 20, 100); const items = await Log.find({ owner: req.user.id }) .skip((page - 1) * limit) .limit(limit) .lean(); const total...
synthetic_v2
python_flask_device_00393
@app.route('/api/device_records/<int:pk>', methods=['GET']) def read_device(pk): the_device = Device.query.get_or_404(pk) return jsonify(the_device.to_dict())
GET
Python
Flask
device
/api/device_records/{id}
[ "idor", "missing_authorization" ]
[ "CWE-639", "CWE-862" ]
high
IDOR: no ownership check on Device GET endpoint.
@app.route('/api/device_records/<int:pk>', methods=['GET']) @login_required def read_device(pk): the_device = Device.query.get_or_404(pk) if the_device.owner_id != current_user.id: abort(403) return jsonify(the_device.to_dict())
synthetic_v2
java_spring_boot_workspace_00394
@GetMapping("/api/workspace/{id}") public Workspace get(@PathVariable Long id) { return repo.findById(id).orElseThrow(() -> new ResponseStatusException(HttpStatus.NOT_FOUND)); }
GET
Java
Spring Boot
workspace
/api/workspace/{id}
[ "idor", "missing_authorization" ]
[ "CWE-639", "CWE-862" ]
high
IDOR in Spring: no ownership verification on Workspace.
@GetMapping("/api/workspace/{id}") @PreAuthorize("isAuthenticated()") public Workspace get(@PathVariable Long id, @AuthenticationPrincipal User user) { Workspace entity = repo.findById(id).orElseThrow(() -> new ResponseStatusException(HttpStatus.NOT_FOUND)); if (!entity.getOwnerId().equals(user.getId())) throw ...
synthetic_v2
javascript_express_js_refund_00395
app.get('/api/refund_records', authenticate, async (req, res) => { const page = parseInt(req.query.page) || 1; const limit = Math.min(parseInt(req.query.limit) || 20, 100); const items = await Refund.find({ owner: req.user.id }) .skip((page - 1) * limit) .limit(limit) .lean(); co...
GET
JavaScript
Express.js
refund
/api/refund_records
[]
[]
none
No vulnerability: properly secured with authentication, validation, and pagination.
app.get('/api/refund_records', authenticate, async (req, res) => { const page = parseInt(req.query.page) || 1; const limit = Math.min(parseInt(req.query.limit) || 20, 100); const items = await Refund.find({ owner: req.user.id }) .skip((page - 1) * limit) .limit(limit) .lean(); co...
synthetic_v2
php_laravel_address_00396
Route::post('/api/address_list', function (Request $request) { $address = Address::create($request->all()); return response()->json($address, 201); });
POST
PHP
Laravel
address
/api/address_list
[ "mass_assignment", "improper_input_validation" ]
[ "CWE-915", "CWE-20" ]
high
Mass assignment in Laravel: $request->all() without validation.
Route::post('/api/address_list', function (Request $request) { $validated = $request->validate([ 'name' => 'required|string|max:255', 'status' => 'in:active,inactive', ]); $address = Address::create($validated); return response()->json($address, 201); });
synthetic_v2
go_gin_campaign_00397
func searchCampaigns(c *gin.Context) { q := c.Query("status") rows, _ := db.Query(fmt.Sprintf("SELECT * FROM campaigns WHERE status LIKE '%%%s%%'", q)) defer rows.Close() var results []Campaign for rows.Next() { var item Campaign rows.Scan(&item.ID, &item.Status) results = ap...
GET
Go
Gin
campaign
/api/campaigns
[ "sql_injection" ]
[ "CWE-89" ]
critical
SQL injection in Go Gin handler using fmt.Sprintf.
func searchCampaigns(c *gin.Context) { q := c.Query("status") rows, err := db.Query("SELECT * FROM campaigns WHERE status LIKE ?", "%"+q+"%") if err != nil { c.JSON(500, gin.H{"error": "query failed"}) return } defer rows.Close() var results []Campaign for rows.Next() { ...
synthetic_v2
python_django_menu_00398
@csrf_exempt def menu_webhook(request): if request.method == 'POST': data = json.loads(request.body) Menu.objects.create(**data) return JsonResponse({'status': 'ok'})
POST
Python
Django
menu
/api/menu_list/webhook/
[ "csrf", "missing_authentication" ]
[ "CWE-352", "CWE-306" ]
high
CSRF exemption on Django webhook with no signature verification.
def menu_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 = MenuWebhookForm(json.loads(request.body)) if form.is_valid(): ...
synthetic_v2
csharp_asp_net_core_workflow_00399
[HttpGet("search")] public IActionResult Search([FromQuery] string q) { var sql = $"SELECT * FROM workflow_data WHERE title LIKE '%{q}%'"; var results = _context.Workflows.FromSqlRaw(sql).ToList(); return Ok(results); }
GET
C#
ASP.NET Core
workflow
/api/workflow_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.Workflows.Where(x => x.Title.Contains(q)).ToList(); return Ok(results); }
synthetic_v2