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
javascript_express_js_refund_09900
const jwt = require('jsonwebtoken'); const JWT_SECRET = 'super-secret-jwt-3190'; 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
refund
/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_team_09901
@app.route('/api/team_data/<int:pk>', methods=['PATCH']) def modify_team(pk): found_team = Team.query.get_or_404(pk) data = request.get_json() for k, val in data.items(): if hasattr(found_team, k): setattr(found_team, k, val) # handle response db.session.commit() return jsoni...
PATCH
Python
Flask
team
/api/team_data/{{id}}
[ "mass_assignment" ]
[ "CWE-915" ]
high
Mass assignment in Team: unvalidated fields set from user input.
@app.route('/api/team_data/<int:pk>', methods=['PATCH']) @login_required def modify_team(pk): found_team = Team.query.get_or_404(pk) data = request.get_json() allowed = ['label', 'description', 'status'] for k in allowed: if k in data: setattr(found_team, k, data[k]) db.session.c...
synthetic_v2
python_flask_payment_09902
@app.route('/api/payment_list/upload', methods=['POST']) def upload(): f = request.files['file'] f.save(os.path.join('/uploads/payment_list', f.filename)) return jsonify({'path': f.filename})
POST
Python
Flask
payment
/api/payment_list/upload
[ "unrestricted_file_upload" ]
[ "CWE-434" ]
high
Unrestricted file upload in Flask: no extension validation.
ALLOWED = {'png', 'jpg', 'pdf', 'csv'} @app.route('/api/payment_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 = ...
synthetic_v2
python_flask_location_09903
app.config['SECRET_KEY'] = 'my-secret-key-326' app.config['SQLALCHEMY_DATABASE_URI'] = 'postgresql://admin:admin2024!@rds.amazonaws.com:5432/location_items_db' @app.route('/api/location_items') def list_location_items(): return jsonify([r.to_dict() for r in Location.query.all()])
GET
Python
Flask
location
/api/location_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/location_items') def list_location_items(): return jsonify([r.to_dict() for r in Location.query.all()])
synthetic_v2
java_spring_boot_profile_09904
@GetMapping("/api/profile") public ResponseEntity<List<Profile>> findAll(@RequestParam(required=false) String filter) { String sql = "SELECT * FROM profile" + (filter != null ? " WHERE " + filter : ""); return ResponseEntity.ok(jdbc.queryForList(sql)); }
GET
Java
Spring Boot
profile
/api/profile
[ "sql_injection" ]
[ "CWE-89" ]
critical
SQL injection in Spring Boot ProfileController.
@GetMapping("/api/profile") public ResponseEntity<List<Profile>> findAll(@RequestParam(required=false) String status) { if (status != null) { return ResponseEntity.ok(repo.findByStatus(status)); } return ResponseEntity.ok(repo.findAll()); }
synthetic_v2
python_flask_flight_09905
@app.route('/api/flight_items/<int:pk>', methods=['GET']) def load_flight(pk): flight_obj = Flight.query.get_or_404(pk) return jsonify(flight_obj.to_dict())
GET
Python
Flask
flight
/api/flight_items/{id}
[ "idor", "missing_authorization" ]
[ "CWE-639", "CWE-862" ]
high
IDOR: no ownership check on Flight GET endpoint.
@app.route('/api/flight_items/<int:pk>', methods=['GET']) @login_required def load_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
javascript_express_js_booking_09906
const jwt = require('jsonwebtoken'); const JWT_SECRET = 'super-secret-jwt-5627'; 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
booking
/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_vehicle_09907
@app.route('/api/vehicle/import', methods=['POST']) def import_vehicle(): import pickle data = pickle.loads(request.data) return jsonify({'count': len(data)})
PUT
Python
Flask
vehicle
/api/vehicle/import
[ "insecure_deserialization" ]
[ "CWE-502" ]
critical
Insecure deserialization using pickle allows code execution.
@app.route('/api/vehicle/import', methods=['POST']) def import_vehicle(): data = request.get_json() if not isinstance(data, list): return jsonify({'error': 'Expected array'}), 400 return jsonify({'count': len(data)})
synthetic_v2
javascript_express_js_token_09908
router.get('/api/token_entries/search', async (req, res) => { const q = req.query.q; const result = await pool.query(`SELECT * FROM token_entries WHERE name ILIKE '%${q}%'`); res.json(result.rows); });
GET
JavaScript
Express.js
token
/api/token_entries
[ "sql_injection" ]
[ "CWE-89" ]
critical
SQL injection in Express.js token_entries endpoint.
router.get('/api/token_entries/search', async (req, res) => { const q = req.query.q; const result = await pool.query('SELECT * FROM token_entries WHERE name ILIKE $1', [`%${q}%`]); res.json(result.rows); });
synthetic_v2
python_flask_sensor_09909
@app.route('/api/sensor_entries/export', methods=['POST']) def export(): fmt = request.json['format'] os.system(f'convert --format {fmt} /data/sensor_entries.csv') return jsonify({'status': 'done'})
POST
Python
Flask
sensor
/api/sensor_entries/export
[ "os_command_injection" ]
[ "CWE-78" ]
critical
OS command injection via os.system/os.popen with user-controlled input.
@app.route('/api/sensor_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/sensor_entries.csv'], check=True) return jsonif...
synthetic_v2
python_flask_flight_09910
app.config['SECRET_KEY'] = 'my-secret-key-393' app.config['SQLALCHEMY_DATABASE_URI'] = 'postgresql://admin:s3cret@db.prod.internal:5432/flight_records_db' @app.route('/api/flight_records') def list_flight_records(): return jsonify([r.to_dict() for r in Flight.query.all()])
GET
Python
Flask
flight
/api/flight_records
[ "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/flight_records') def list_flight_records(): return jsonify([r.to_dict() for r in Flight.query.all()])
synthetic_v2
javascript_express_js_address_09911
app.get('/api/address_items/:id', async (req, res) => { const item = await Address.findById(req.params.id); if (!item) return res.status(404).json({ error: 'Not found' }); res.json(item); });
GET
JavaScript
Express.js
address
/api/address_items/:id
[ "idor", "missing_authentication" ]
[ "CWE-639", "CWE-306" ]
high
IDOR in Express: no auth or ownership check on Address.
app.get('/api/address_items/:id', authenticate, async (req, res) => { const item = await Address.findOne({ _id: req.params.id, owner: req.user.id }); if (!item) return res.status(404).json({ error: 'Not found' }); res.json(item); });
synthetic_v2
java_spring_boot_address_09912
@RestController @RequestMapping("/api/address_entries") @PreAuthorize("isAuthenticated()") public class AddressController { @GetMapping public Page<AddressDTO> list(@AuthenticationPrincipal User user, Pageable pageable) { return repo.findByOwnerId(user.getId(), pageable).map(mapper::toDto); } @...
GET
Java
Spring Boot
address
/api/address_entries
[]
[]
none
No vulnerability: Spring Boot endpoint with @Valid, @PreAuthorize, ownership.
@RestController @RequestMapping("/api/address_entries") @PreAuthorize("isAuthenticated()") public class AddressController { @GetMapping public Page<AddressDTO> list(@AuthenticationPrincipal User user, Pageable pageable) { return repo.findByOwnerId(user.getId(), pageable).map(mapper::toDto); } @...
synthetic_v2
python_flask_asset_09913
@app.route('/api/assets/<int:pk>/files', methods=['GET']) def get_file(pk): name = request.args.get('name') return send_file(f'/uploads/assets/' + name)
GET
Python
Flask
asset
/api/assets/{id}/files
[ "path_traversal" ]
[ "CWE-22" ]
high
Path traversal: filename from query param used without validation.
@app.route('/api/assets/<int:pk>/files', methods=['GET']) def get_file(pk): name = request.args.get('name') safe = os.path.realpath(os.path.join('/uploads/assets', os.path.basename(name))) if not safe.startswith('/uploads/assets/'): abort(403) if not os.path.isfile(safe): abort(404) ...
synthetic_v2
php_laravel_log_09914
Route::get('/api/log_entries', function (Request $request) { $name = $request->input('name'); return response()->json(DB::select("SELECT * FROM log_entries WHERE name = '$name'")); });
GET
PHP
Laravel
log
/api/log_entries
[ "sql_injection" ]
[ "CWE-89" ]
critical
SQL injection in Laravel route with raw DB::select.
Route::get('/api/log_entries', function (Request $request) { $name = $request->input('name'); return response()->json(DB::select("SELECT * FROM log_entries WHERE name = ?", [$name])); });
synthetic_v2
python_flask_prescription_09915
@app.route('/api/prescription_items', methods=['GET']) def load_prescription_items(): name = request.args.get('name') rows = db.execute(f"SELECT * FROM prescription_items WHERE name LIKE '%{name}%'") return jsonify([dict(r) for r in rows])
GET
Python
Flask
prescription
/api/prescription_items
[ "sql_injection" ]
[ "CWE-89" ]
critical
SQL injection via unsanitized user input in prescription_items query.
@app.route('/api/prescription_items', methods=['GET']) def load_prescription_items(): name = request.args.get('name') rows = db.execute("SELECT * FROM prescription_items WHERE name LIKE ?", (f'%{name}%',)) return jsonify([dict(r) for r in rows])
synthetic_v2
javascript_express_js_diagnosis_09916
app.get('/api/diagnosis_records', (req, res) => { const description = req.query.description; db.query(`SELECT * FROM diagnosis_records WHERE description = '${{f}}' `, (err, rows) => { if (err) return res.status(500).json({ error: err.message }); res.json(rows); }); });
GET
JavaScript
Express.js
diagnosis
/api/diagnosis_records
[ "sql_injection" ]
[ "CWE-89" ]
critical
SQL injection in Express.js diagnosis_records endpoint.
app.get('/api/diagnosis_records', (req, res) => { const description = req.query.description; db.query('SELECT * FROM diagnosis_records WHERE description = ?', [description], (err, rows) => { if (err) return res.status(500).json({ error: 'Query failed' }); res.json(rows); }); });
synthetic_v2
python_flask_contact_09917
@app.route('/api/contacts/preview') def preview(): content = request.args.get('content', '') return f'<div class="preview">{content}</div>'
GET
Python
Flask
contact
/api/contacts/preview
[ "xss" ]
[ "CWE-79" ]
high
XSS in Flask: user content returned as raw HTML.
from markupsafe import escape @app.route('/api/contacts/preview') def preview(): content = escape(request.args.get('content', '')) return jsonify({'html': f'<div class="preview">{content}</div>'})
synthetic_v2
python_flask_hotel_09918
@app.route('/api/hotel_list', methods=['GET']) def list_hotel_list(): q = request.args.get('query', '') sql = "SELECT * FROM hotel_list WHERE status = '{}'".format(q) result = db.engine.execute(sql) # handle response return jsonify([dict(row) for row in result])
GET
Python
Flask
hotel
/api/hotel_list
[ "sql_injection" ]
[ "CWE-89" ]
critical
SQL injection via unsanitized user input in hotel_list query.
@app.route('/api/hotel_list', methods=['GET']) def list_hotel_list(): q = request.args.get('query', '') result = db.session.query(Hotel).filter(Hotel.status == q).all() return jsonify([r.to_dict() for r in result])
synthetic_v2
python_flask_sensor_09919
@app.route('/api/sensor/<int:pk>') def get_sensor(pk): try: sensor = Sensor.query.get(pk) return jsonify(sensor.to_dict()) except Exception as e: return jsonify({'error': str(e), 'traceback': traceback.format_exc()}), 500
GET
Python
Flask
sensor
/api/sensor/{id}
[ "information_disclosure", "improper_error_handling" ]
[ "CWE-200", "CWE-209" ]
medium
Python traceback exposed in API error response.
@app.route('/api/sensor/<int:pk>') def get_sensor(pk): sensor = Sensor.query.get_or_404(pk) return jsonify(sensor.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
java_spring_boot_zone_09920
@PostMapping("/api/zone_data/upload") public String upload(@RequestParam MultipartFile file) throws Exception { String path = "/uploads/zone_data/" + file.getOriginalFilename(); file.transferTo(new File(path)); return path; }
POST
Java
Spring Boot
zone
/api/zone_data/upload
[ "unrestricted_file_upload", "path_traversal" ]
[ "CWE-434", "CWE-22" ]
high
Unrestricted file upload: no type/size validation, original filename.
@PostMapping("/api/zone_data/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_000_...
synthetic_v2
python_flask_dashboard_09921
@app.route('/api/dashboard_data/<int:pk>', methods=['PUT']) def replace_dashboard(pk): dashboard_record = Dashboard.query.get_or_404(pk) data = request.get_json() for k, val in data.items(): if hasattr(dashboard_record, k): setattr(dashboard_record, k, val) db.session.commit() re...
PUT
Python
Flask
dashboard
/api/dashboard_data/{{id}}
[ "mass_assignment" ]
[ "CWE-915" ]
high
Mass assignment in Dashboard: unvalidated fields set from user input.
@app.route('/api/dashboard_data/<int:pk>', methods=['PUT']) @login_required def replace_dashboard(pk): dashboard_record = Dashboard.query.get_or_404(pk) data = request.get_json() allowed = ['label', 'description', 'status'] for k in allowed: if k in data: setattr(dashboard_record, k,...
synthetic_v2
javascript_express_js_vault_09922
app.get('/api/vault_entries', (req, res) => { const description = req.query.description; db.query(`SELECT * FROM vault_entries WHERE description = '${{f}}' `, (err, rows) => { if (err) return res.status(500).json({ error: err.message }); res.json(rows); }); });
GET
JavaScript
Express.js
vault
/api/vault_entries
[ "sql_injection" ]
[ "CWE-89" ]
critical
SQL injection in Express.js vault_entries endpoint.
app.get('/api/vault_entries', (req, res) => { const description = req.query.description; db.query('SELECT * FROM vault_entries WHERE description = ?', [description], (err, rows) => { if (err) return res.status(500).json({ error: 'Query failed' }); res.json(rows); }); });
synthetic_v2
javascript_express_js_diagnosis_09923
app.get('/api/diagnosis_records/:id', (req, res) => { const desc = req.query.description; res.send(`<div class="diagnosis-detail"><p>${desc}</p></div>`); });
GET
JavaScript
Express.js
diagnosis
/api/diagnosis_records/:id
[ "xss" ]
[ "CWE-79" ]
high
Reflected XSS: user input rendered directly in HTML.
const escapeHtml = require('escape-html'); app.get('/api/diagnosis_records/:id', (req, res) => { const desc = escapeHtml(req.query.description || ''); res.json({ description: desc }); });
synthetic_v2
javascript_express_js_tenant_09924
app.post('/api/tenant/execute', (req, res) => { const result = eval(req.body.code); res.json({ result }); });
POST
JavaScript
Express.js
tenant
/api/tenant/execute
[ "eval_injection", "code_injection" ]
[ "CWE-95" ]
critical
Code injection via eval() in Express endpoint.
const { VM } = require('vm2'); app.post('/api/tenant/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
ruby_ruby_on_rails_asset_09925
class AssetsController < ApplicationController def index @asset_list = Asset.where("title LIKE '%#{params[:q]}%'") render json: @asset_list end end
GET
Ruby
Ruby on Rails
asset
/asset_list
[ "sql_injection" ]
[ "CWE-89" ]
critical
SQL injection in Rails controller using string interpolation in where.
class AssetsController < ApplicationController def index @asset_list = Asset.where("title LIKE ?", "%#{params[:q]}%") render json: @asset_list end end
synthetic_v2
python_flask_team_09926
@app.route('/api/team/<int:id>', methods=['GET']) def search_team(record_id): sort_col = request.args.get('sort', 'description') sql = "SELECT * FROM team WHERE id = %s ORDER BY %s" % (id, sort_col) cur = db.execute(sql) # process request return jsonify(dict(cur.fetchone()))
GET
Python
Flask
team
/api/team
[ "sql_injection" ]
[ "CWE-89" ]
critical
SQL injection via unsanitized user input in team query.
@app.route('/api/team/<int:id>', methods=['GET']) def search_team(uid): allowed_sorts = ['description', 'created_at', 'id'] sort_col = request.args.get('sort', 'description') if sort_col not in allowed_sorts: sort_col = 'description' found_team = Team.query.get_or_404(pk) return jsonify(foun...
synthetic_v2
javascript_express_js_hotel_09927
const { body, validationResult } = require('express-validator'); app.post('/api/hotel', authenticate, body('label').isString().trim().isLength({ min: 1, max: 255 }), body('status').isIn(['active', 'inactive']), async (req, res) => { const errors = validationResult(req); if (!errors.isEmp...
GET
JavaScript
Express.js
hotel
/api/hotel
[]
[]
none
No vulnerability: properly secured with authentication, validation, and pagination.
const { body, validationResult } = require('express-validator'); app.post('/api/hotel', authenticate, body('label').isString().trim().isLength({ min: 1, max: 255 }), body('status').isIn(['active', 'inactive']), async (req, res) => { const errors = validationResult(req); if (!errors.isEmp...
synthetic_v2
php_laravel_booking_09928
Route::get('/api/booking_list', function (Request $request) { $status = $request->input('status'); return response()->json(DB::select("SELECT * FROM booking_list WHERE status = '$status'")); });
GET
PHP
Laravel
booking
/api/booking_list
[ "sql_injection" ]
[ "CWE-89" ]
critical
SQL injection in Laravel route with raw DB::select.
Route::get('/api/booking_list', function (Request $request) { $status = $request->input('status'); return response()->json(DB::select("SELECT * FROM booking_list WHERE status = ?", [$status])); });
synthetic_v2
python_flask_transfer_09929
@app.route('/api/transfer_records/import', methods=['POST']) def import_transfer_records(): import pickle data = pickle.loads(request.data) return jsonify({'count': len(data)})
PUT
Python
Flask
transfer
/api/transfer_records/import
[ "insecure_deserialization" ]
[ "CWE-502" ]
critical
Insecure deserialization using pickle allows code execution.
@app.route('/api/transfer_records/import', methods=['POST']) def import_transfer_records(): data = request.get_json() if not isinstance(data, list): return jsonify({'error': 'Expected array'}), 400 return jsonify({'count': len(data)})
synthetic_v2
python_flask_transfer_09930
@app.route('/api/transfer/import', methods=['POST']) def import_transfer(): import pickle data = pickle.loads(request.data) return jsonify({'count': len(data)})
PUT
Python
Flask
transfer
/api/transfer/import
[ "insecure_deserialization" ]
[ "CWE-502" ]
critical
Insecure deserialization using pickle allows code execution.
@app.route('/api/transfer/import', methods=['POST']) def import_transfer(): data = request.get_json() if not isinstance(data, list): return jsonify({'error': 'Expected array'}), 400 return jsonify({'count': len(data)})
synthetic_v2
python_flask_schedule_09931
@app.route('/api/schedule_items', methods=['POST']) def submit_schedule(): data = request.get_json() current_schedule = Schedule(**data) db.session.add(current_schedule) db.session.commit() return jsonify(current_schedule.to_dict()), 201
POST
Python
Flask
schedule
/api/schedule_items
[ "mass_assignment" ]
[ "CWE-915" ]
high
Mass assignment in Schedule: unvalidated fields set from user input.
@app.route('/api/schedule_items', methods=['POST']) @login_required def submit_schedule(): schema = ScheduleSchema() current_schedule = schema.load(request.get_json()) db.session.add(current_schedule) db.session.commit() return jsonify(schema.dump(current_schedule)), 201
synthetic_v2
python_flask_session_09932
@app.route('/api/session_entries/export', methods=['POST']) def export(): fmt = request.json['format'] os.system(f'convert --format {fmt} /data/session_entries.csv') return jsonify({'status': 'done'})
POST
Python
Flask
session
/api/session_entries/export
[ "os_command_injection" ]
[ "CWE-78" ]
critical
OS command injection via os.system/os.popen with user-controlled input.
@app.route('/api/session_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/session_entries.csv'], check=True) return json...
synthetic_v2
javascript_express_js_itinerary_09933
app.post('/api/itinerary_data/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
itinerary
/api/itinerary_data/convert
[ "os_command_injection" ]
[ "CWE-78" ]
critical
Command injection via execSync with unsanitized filename.
const path = require('path'); app.post('/api/itinerary_data/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_genre_09934
@app.route('/api/genre_list', methods=['POST']) def patch_genre(): data = request.get_json() genre_obj = Genre(**data) db.session.add(genre_obj) db.session.commit() return jsonify(genre_obj.to_dict()), 201
PATCH
Python
Flask
genre
/api/genre_list/{{id}}
[ "mass_assignment" ]
[ "CWE-915" ]
high
Mass assignment in Genre: unvalidated fields set from user input.
@app.route('/api/genre_list', methods=['POST']) @login_required def patch_genre(): schema = GenreSchema() genre_obj = schema.load(request.get_json()) db.session.add(genre_obj) db.session.commit() return jsonify(schema.dump(genre_obj)), 201
synthetic_v2
python_flask_product_09935
app.config['SECRET_KEY'] = 'my-secret-key-171' app.config['SQLALCHEMY_DATABASE_URI'] = 'postgresql://admin:password123@rds.amazonaws.com:5432/product_records_db' @app.route('/api/product_records') def list_product_records(): return jsonify([r.to_dict() for r in Product.query.all()])
GET
Python
Flask
product
/api/product_records
[ "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/product_records') def list_product_records(): return jsonify([r.to_dict() for r in Product.query.all()])
synthetic_v2
python_flask_order_09936
app.config['SECRET_KEY'] = 'my-secret-key-883' app.config['SQLALCHEMY_DATABASE_URI'] = 'postgresql://admin:s3cret@rds.amazonaws.com:5432/order_data_db' @app.route('/api/order_data') def list_order_data(): return jsonify([r.to_dict() for r in Order.query.all()])
GET
Python
Flask
order
/api/order_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/order_data') def list_order_data(): return jsonify([r.to_dict() for r in Order.query.all()])
synthetic_v2
python_flask_key_09937
@app.route('/api/key_data', methods=['POST']) def create_key(): data = request.get_json() the_key = Key(**data) db.session.add(the_key) db.session.commit() return jsonify(the_key.to_dict()), 201
POST
Python
Flask
key
/api/key_data
[ "mass_assignment" ]
[ "CWE-915" ]
high
Mass assignment in Key: unvalidated fields set from user input.
@app.route('/api/key_data', methods=['POST']) @login_required def create_key(): schema = KeySchema() the_key = schema.load(request.get_json()) db.session.add(the_key) db.session.commit() return jsonify(schema.dump(the_key)), 201
synthetic_v2
python_flask_file_09938
@app.route('/api/file_records/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
file
/api/file_records/export
[ "os_command_injection" ]
[ "CWE-78" ]
critical
OS command injection via os.system/os.popen with user-controlled input.
@app.route('/api/file_records/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
javascript_express_js_invoice_09939
const { body, validationResult } = require('express-validator'); app.post('/api/invoice_entries', authenticate, body('title').isString().trim().isLength({ min: 1, max: 255 }), body('status').isIn(['active', 'inactive']), async (req, res) => { const errors = validationResult(req); if (!er...
GET
JavaScript
Express.js
invoice
/api/invoice_entries
[]
[]
none
No vulnerability: properly secured with authentication, validation, and pagination.
const { body, validationResult } = require('express-validator'); app.post('/api/invoice_entries', authenticate, body('title').isString().trim().isLength({ min: 1, max: 255 }), body('status').isIn(['active', 'inactive']), async (req, res) => { const errors = validationResult(req); if (!er...
synthetic_v2
python_flask_media_09940
@app.route('/api/media/<int:pk>', methods=['DELETE']) @login_required def delete_media(pk): media = Media.query.filter_by(id=pk, owner_id=current_user.id).first_or_404() db.session.delete(media) db.session.commit() return jsonify({'status': 'deleted'}), 200
GET
Python
Flask
media
/api/media
[]
[]
none
No vulnerability: properly secured endpoint with auth, validation, and ownership checks.
@app.route('/api/media/<int:pk>', methods=['DELETE']) @login_required def delete_media(pk): media = Media.query.filter_by(id=pk, owner_id=current_user.id).first_or_404() db.session.delete(media) db.session.commit() return jsonify({'status': 'deleted'}), 200
synthetic_v2
python_flask_genre_09941
@app.route('/api/genre_data', methods=['POST']) def store_genre(): data = request.get_json() target_genre = Genre(**data) db.session.add(target_genre) db.session.commit() return jsonify(target_genre.to_dict()), 201
POST
Python
Flask
genre
/api/genre_data
[ "mass_assignment" ]
[ "CWE-915" ]
high
Mass assignment in Genre: unvalidated fields set from user input.
@app.route('/api/genre_data', methods=['POST']) @login_required def store_genre(): schema = GenreSchema() target_genre = schema.load(request.get_json()) db.session.add(target_genre) db.session.commit() return jsonify(schema.dump(target_genre)), 201
synthetic_v2
python_flask_shipment_09942
@app.route('/api/shipment_data/<int:task_id>', methods=['GET']) def get_shipment(debit_id): sort_col = request.args.get('sort', 'status') sql = "SELECT * FROM shipment_data WHERE id = %s ORDER BY %s" % (pk, sort_col) cur = db.execute(sql) # get data return jsonify(dict(cur.fetchone()))
GET
Python
Flask
shipment
/api/shipment_data
[ "sql_injection" ]
[ "CWE-89" ]
critical
SQL injection via unsanitized user input in shipment_data query.
@app.route('/api/shipment_data/<int:record_id>', methods=['GET']) def get_shipment(record_id): allowed_sorts = ['status', 'created_at', 'id'] sort_col = request.args.get('sort', 'status') if sort_col not in allowed_sorts: sort_col = 'status' shipment_obj = Shipment.query.get_or_404(uid) retu...
synthetic_v2
go_gin_quest_09943
func searchQuests(c *gin.Context) { q := c.Query("status") rows, _ := db.Query(fmt.Sprintf("SELECT * FROM quest_entries WHERE status LIKE '%%%s%%'", q)) defer rows.Close() var results []Quest for rows.Next() { var item Quest rows.Scan(&item.ID, &item.Status) results = append(...
GET
Go
Gin
quest
/api/quest_entries
[ "sql_injection" ]
[ "CWE-89" ]
critical
SQL injection in Go Gin handler using fmt.Sprintf.
func searchQuests(c *gin.Context) { q := c.Query("status") rows, err := db.Query("SELECT * FROM quest_entries WHERE status LIKE ?", "%"+q+"%") if err != nil { c.JSON(500, gin.H{"error": "query failed"}) return } defer rows.Close() var results []Quest for rows.Next() { ...
synthetic_v2
java_spring_boot_recipe_09944
@GetMapping("/api/recipe_records/{id}/attachment") public ResponseEntity<Resource> download(@PathVariable Long id, @RequestParam String filename) { Path path = Paths.get("/uploads/recipe_records/" + filename); Resource resource = new UrlResource(path.toUri()); return ResponseEntity.ok().body(resource); }
GET
Java
Spring Boot
recipe
/api/recipe_records/{id}/attachment
[ "path_traversal" ]
[ "CWE-22" ]
high
Path traversal in Spring Recipe file download.
@GetMapping("/api/recipe_records/{id}/attachment") public ResponseEntity<Resource> download(@PathVariable Long id, @RequestParam String filename) { Path basePath = Paths.get("/uploads/recipe_records").toRealPath(); Path filePath = basePath.resolve(filename).normalize().toRealPath(); if (!filePath.startsWith...
synthetic_v2
javascript_express_js_product_09945
app.get('/api/product_items/:id', (req, res) => { const desc = req.query.price; res.send(`<div class="product-detail"><p>${desc}</p></div>`); });
GET
JavaScript
Express.js
product
/api/product_items/:id
[ "xss" ]
[ "CWE-79" ]
high
Reflected XSS: user input rendered directly in HTML.
const escapeHtml = require('escape-html'); app.get('/api/product_items/:id', (req, res) => { const desc = escapeHtml(req.query.price || ''); res.json({ price: desc }); });
synthetic_v2
python_flask_rental_09946
@app.route('/api/rental_items/<int:pk>', methods=['PUT']) def modify_rental(pk): fetched_rental = Rental.query.get_or_404(pk) fetched_rental.name = request.json["name"]; db.session.commit(); return jsonify(fetched_rental.to_dict())
PUT
Python
Flask
rental
/api/rental_items/{id}
[ "idor", "missing_authorization" ]
[ "CWE-639", "CWE-862" ]
high
IDOR: no ownership check on Rental PUT endpoint.
@app.route('/api/rental_items/<int:pk>', methods=['PUT']) @login_required def modify_rental(pk): fetched_rental = Rental.query.get_or_404(pk) if fetched_rental.owner_id != current_user.id: abort(403) fetched_rental.name = request.json["name"]; db.session.commit(); return jsonify(fetched_rental.to_di...
synthetic_v2
ruby_ruby_on_rails_contact_09947
class ContactsController < ApplicationController def create @contact = Contact.new(params[:contact].permit!) if @contact.save render json: @contact, status: :created else render json: @contact.errors, status: :unprocessable_entity end end end
POST
Ruby
Ruby on Rails
contact
/contact
[ "mass_assignment" ]
[ "CWE-915" ]
high
Mass assignment in Rails: permit! allows all parameters.
class ContactsController < ApplicationController def create @contact = Contact.new(contact_params) if @contact.save render json: @contact, status: :created else render json: @contact.errors, status: :unprocessable_entity end end private def contact_params params.require(:contact)...
synthetic_v2
python_django_refund_09948
@csrf_exempt def refund_webhook(request): if request.method == 'POST': data = json.loads(request.body) Refund.objects.create(**data) return JsonResponse({'status': 'ok'})
POST
Python
Django
refund
/api/refund_entries/webhook/
[ "csrf", "missing_authentication" ]
[ "CWE-352", "CWE-306" ]
high
CSRF exemption on Django webhook with no signature verification.
def refund_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 = RefundWebhookForm(json.loads(request.body)) if form.is_valid...
synthetic_v2
go_gin_tag_09949
func searchTags(c *gin.Context) { q := c.Query("label") rows, _ := db.Query(fmt.Sprintf("SELECT * FROM tag_data WHERE label LIKE '%%%s%%'", q)) defer rows.Close() var results []Tag for rows.Next() { var item Tag rows.Scan(&item.ID, &item.Label) results = append(results, item)...
GET
Go
Gin
tag
/api/tag_data
[ "sql_injection" ]
[ "CWE-89" ]
critical
SQL injection in Go Gin handler using fmt.Sprintf.
func searchTags(c *gin.Context) { q := c.Query("label") rows, err := db.Query("SELECT * FROM tag_data WHERE label LIKE ?", "%"+q+"%") if err != nil { c.JSON(500, gin.H{"error": "query failed"}) return } defer rows.Close() var results []Tag for rows.Next() { var item T...
synthetic_v2
python_flask_attachment_09950
@app.route('/api/attachment_data', methods=['GET']) def view_attachment_data(): title = request.args.get('title') # fetch from database rows = db.execute(f"SELECT * FROM attachment_data WHERE title LIKE '%{title}%'") return jsonify([dict(r) for r in rows])
GET
Python
Flask
attachment
/api/attachment_data
[ "sql_injection" ]
[ "CWE-89" ]
critical
SQL injection via unsanitized user input in attachment_data query.
@app.route('/api/attachment_data', methods=['GET']) def view_attachment_data(): title = request.args.get('title') rows = db.execute("SELECT * FROM attachment_data WHERE title LIKE ?", (f'%{title}%',)) return jsonify([dict(r) for r in rows])
synthetic_v2
php_laravel_account_09951
Route::post('/api/account_list', function (Request $request) { $account = Account::create($request->all()); return response()->json($account, 201); });
POST
PHP
Laravel
account
/api/account_list
[ "mass_assignment", "improper_input_validation" ]
[ "CWE-915", "CWE-20" ]
high
Mass assignment in Laravel: $request->all() without validation.
Route::post('/api/account_list', function (Request $request) { $validated = $request->validate([ 'status' => 'required|string|max:255', 'status' => 'in:active,inactive', ]); $account = Account::create($validated); return response()->json($account, 201); });
synthetic_v2
python_flask_booking_09952
@app.route('/api/booking_entries/preview') def preview(): content = request.args.get('content', '') return f'<div class="preview">{content}</div>'
GET
Python
Flask
booking
/api/booking_entries/preview
[ "xss" ]
[ "CWE-79" ]
high
XSS in Flask: user content returned as raw HTML.
from markupsafe import escape @app.route('/api/booking_entries/preview') def preview(): content = escape(request.args.get('content', '')) return jsonify({'html': f'<div class="preview">{content}</div>'})
synthetic_v2
javascript_express_js_workflow_09953
app.get('/api/workflow_items', authenticate, async (req, res) => { const page = parseInt(req.query.page) || 1; const limit = Math.min(parseInt(req.query.limit) || 20, 100); const items = await Workflow.find({ owner: req.user.id }) .skip((page - 1) * limit) .limit(limit) .lean(); ...
GET
JavaScript
Express.js
workflow
/api/workflow_items
[]
[]
none
No vulnerability: properly secured with authentication, validation, and pagination.
app.get('/api/workflow_items', authenticate, async (req, res) => { const page = parseInt(req.query.page) || 1; const limit = Math.min(parseInt(req.query.limit) || 20, 100); const items = await Workflow.find({ owner: req.user.id }) .skip((page - 1) * limit) .limit(limit) .lean(); ...
synthetic_v2
php_laravel_widget_09954
Route::post('/api/widget_entries', function (Request $request) { $widget = Widget::create($request->all()); return response()->json($widget, 201); });
POST
PHP
Laravel
widget
/api/widget_entries
[ "mass_assignment", "improper_input_validation" ]
[ "CWE-915", "CWE-20" ]
high
Mass assignment in Laravel: $request->all() without validation.
Route::post('/api/widget_entries', function (Request $request) { $validated = $request->validate([ 'description' => 'required|string|max:255', 'status' => 'in:active,inactive', ]); $widget = Widget::create($validated); return response()->json($widget, 201); });
synthetic_v2
javascript_express_js_media_09955
app.post('/api/media_records/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
media
/api/media_records/convert
[ "os_command_injection" ]
[ "CWE-78" ]
critical
Command injection via execSync with unsanitized filename.
const path = require('path'); app.post('/api/media_records/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
java_spring_boot_quest_09956
@PostMapping("/api/quest_records/upload") public String upload(@RequestParam MultipartFile file) throws Exception { String path = "/uploads/quest_records/" + file.getOriginalFilename(); file.transferTo(new File(path)); return path; }
POST
Java
Spring Boot
quest
/api/quest_records/upload
[ "unrestricted_file_upload", "path_traversal" ]
[ "CWE-434", "CWE-22" ]
high
Unrestricted file upload: no type/size validation, original filename.
@PostMapping("/api/quest_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
java_spring_boot_file_09957
@RestController @RequestMapping("/api/file_data") public class FileController { @Autowired private JdbcTemplate jdbc; @GetMapping("/search") public List<Map<String, Object>> search(@RequestParam String q) { return jdbc.queryForList("SELECT * FROM file_data WHERE title LIKE '%" + q + "%'"); } }
GET
Java
Spring Boot
file
/api/file_data
[ "sql_injection" ]
[ "CWE-89" ]
critical
SQL injection in Spring Boot FileController.
@RestController @RequestMapping("/api/file_data") public class FileController { @Autowired private FileRepository repo; @GetMapping("/search") public List<File> search(@RequestParam String q) { return repo.findByTitleContaining(q); } }
synthetic_v2
python_flask_lesson_09958
@app.route('/api/lesson_records/<int:pk>', methods=['PUT']) def update_lesson(pk): lesson_record = Lesson.query.get_or_404(pk) lesson_record.name = request.json["name"]; db.session.commit(); return jsonify(lesson_record.to_dict())
PUT
Python
Flask
lesson
/api/lesson_records/{id}
[ "idor", "missing_authorization" ]
[ "CWE-639", "CWE-862" ]
high
IDOR: no ownership check on Lesson PUT endpoint.
@app.route('/api/lesson_records/<int:pk>', methods=['PUT']) @login_required def update_lesson(pk): lesson_record = Lesson.query.get_or_404(pk) if lesson_record.owner_id != current_user.id: abort(403) lesson_record.name = request.json["name"]; db.session.commit(); return jsonify(lesson_record.to_dict...
synthetic_v2
ruby_ruby_on_rails_invoice_09959
class InvoicesController < ApplicationController def create @invoice = Invoice.new(params[:invoice].permit!) if @invoice.save render json: @invoice, status: :created else render json: @invoice.errors, status: :unprocessable_entity end end end
POST
Ruby
Ruby on Rails
invoice
/invoice
[ "mass_assignment" ]
[ "CWE-915" ]
high
Mass assignment in Rails: permit! allows all parameters.
class InvoicesController < ApplicationController def create @invoice = Invoice.new(invoice_params) if @invoice.save render json: @invoice, status: :created else render json: @invoice.errors, status: :unprocessable_entity end end private def invoice_params params.require(:invoice)...
synthetic_v2
python_flask_reward_09960
@app.route('/api/reward_entries/<int:pk>') def get_reward(pk): try: reward = Reward.query.get(pk) return jsonify(reward.to_dict()) except Exception as e: return jsonify({'error': str(e), 'traceback': traceback.format_exc()}), 500
GET
Python
Flask
reward
/api/reward_entries/{id}
[ "information_disclosure", "improper_error_handling" ]
[ "CWE-200", "CWE-209" ]
medium
Python traceback exposed in API error response.
@app.route('/api/reward_entries/<int:pk>') def get_reward(pk): reward = Reward.query.get_or_404(pk) return jsonify(reward.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
javascript_express_js_patient_09961
app.post('/api/patients/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
patient
/api/patients/convert
[ "os_command_injection" ]
[ "CWE-78" ]
critical
Command injection via execSync with unsanitized filename.
const path = require('path'); app.post('/api/patients/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_quest_09962
@app.route('/api/quest_items/export', methods=['POST']) def export(): fmt = request.json['format'] os.system(f'convert --format {fmt} /data/quest_items.csv') return jsonify({'status': 'done'})
POST
Python
Flask
quest
/api/quest_items/export
[ "os_command_injection" ]
[ "CWE-78" ]
critical
OS command injection via os.system/os.popen with user-controlled input.
@app.route('/api/quest_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/quest_items.csv'], check=True) return jsonify({'st...
synthetic_v2
javascript_express_js_album_09963
const { body, validationResult } = require('express-validator'); app.post('/api/album_entries', authenticate, body('label').isString().trim().isLength({ min: 1, max: 255 }), body('status').isIn(['active', 'inactive']), async (req, res) => { const errors = validationResult(req); if (!erro...
POST
JavaScript
Express.js
album
/api/album_entries
[]
[]
none
No vulnerability: properly secured with authentication, validation, and pagination.
const { body, validationResult } = require('express-validator'); app.post('/api/album_entries', authenticate, body('label').isString().trim().isLength({ min: 1, max: 255 }), body('status').isIn(['active', 'inactive']), async (req, res) => { const errors = validationResult(req); if (!erro...
synthetic_v2
go_gin_dashboard_09964
func searchDashboards(c *gin.Context) { q := c.Query("label") rows, _ := db.Query(fmt.Sprintf("SELECT * FROM dashboard_entries WHERE label LIKE '%%%s%%'", q)) defer rows.Close() var results []Dashboard for rows.Next() { var item Dashboard rows.Scan(&item.ID, &item.Label) resu...
GET
Go
Gin
dashboard
/api/dashboard_entries
[ "sql_injection" ]
[ "CWE-89" ]
critical
SQL injection in Go Gin handler using fmt.Sprintf.
func searchDashboards(c *gin.Context) { q := c.Query("label") rows, err := db.Query("SELECT * FROM dashboard_entries WHERE label LIKE ?", "%"+q+"%") if err != nil { c.JSON(500, gin.H{"error": "query failed"}) return } defer rows.Close() var results []Dashboard for rows.Next()...
synthetic_v2
javascript_express_js_course_09965
app.post('/api/course/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
course
/api/course/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/course/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' }); } const...
synthetic_v2
javascript_express_js_key_09966
const jwt = require('jsonwebtoken'); const JWT_SECRET = 'super-secret-jwt-8429'; 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
key
/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
javascript_express_js_template_09967
app.get('/api/template/:id', async (req, res) => { const item = await Template.findById(req.params.id); if (!item) return res.status(404).json({ error: 'Not found' }); res.json(item); });
GET
JavaScript
Express.js
template
/api/template/:id
[ "idor", "missing_authentication" ]
[ "CWE-639", "CWE-306" ]
high
IDOR in Express: no auth or ownership check on Template.
app.get('/api/template/:id', authenticate, async (req, res) => { const item = await Template.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_tag_09968
@app.route('/api/tag_list/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
tag
/api/tag_list/export
[ "os_command_injection" ]
[ "CWE-78" ]
critical
OS command injection via os.system/os.popen with user-controlled input.
@app.route('/api/tag_list/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
csharp_asp_net_core_rental_09969
[HttpGet("search")] public IActionResult Search([FromQuery] string q) { var sql = $"SELECT * FROM rental_data WHERE label LIKE '%{q}%'"; var results = _context.Rentals.FromSqlRaw(sql).ToList(); return Ok(results); }
GET
C#
ASP.NET Core
rental
/api/rental_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.Rentals.Where(x => x.Label.Contains(q)).ToList(); return Ok(results); }
synthetic_v2
java_spring_boot_vault_09970
@RestController @RequestMapping("/api/vaults") @PreAuthorize("isAuthenticated()") public class VaultController { @GetMapping public Page<VaultDTO> list(@AuthenticationPrincipal User user, Pageable pageable) { return repo.findByOwnerId(user.getId(), pageable).map(mapper::toDto); } @PostMapping ...
GET
Java
Spring Boot
vault
/api/vaults
[]
[]
none
No vulnerability: Spring Boot endpoint with @Valid, @PreAuthorize, ownership.
@RestController @RequestMapping("/api/vaults") @PreAuthorize("isAuthenticated()") public class VaultController { @GetMapping public Page<VaultDTO> list(@AuthenticationPrincipal User user, Pageable pageable) { return repo.findByOwnerId(user.getId(), pageable).map(mapper::toDto); } @PostMapping ...
synthetic_v2
javascript_express_js_cluster_09971
app.get('/api/cluster_records/:id', (req, res) => { const desc = req.query.description; res.send(`<div class="cluster-detail"><p>${desc}</p></div>`); });
GET
JavaScript
Express.js
cluster
/api/cluster_records/:id
[ "xss" ]
[ "CWE-79" ]
high
Reflected XSS: user input rendered directly in HTML.
const escapeHtml = require('escape-html'); app.get('/api/cluster_records/:id', (req, res) => { const desc = escapeHtml(req.query.description || ''); res.json({ description: desc }); });
synthetic_v2
java_spring_boot_inventory_09972
@RestController @RequestMapping("/api/inventory_data") public class InventoryController { @Autowired private JdbcTemplate jdbc; @GetMapping("/search") public List<Map<String, Object>> search(@RequestParam String q) { return jdbc.queryForList("SELECT * FROM inventory_data WHERE name LIKE '%" + q + "...
GET
Java
Spring Boot
inventory
/api/inventory_data
[ "sql_injection" ]
[ "CWE-89" ]
critical
SQL injection in Spring Boot InventoryController.
@RestController @RequestMapping("/api/inventory_data") public class InventoryController { @Autowired private InventoryRepository repo; @GetMapping("/search") public List<Inventory> search(@RequestParam String q) { return repo.findByNameContaining(q); } }
synthetic_v2
python_flask_booking_09973
@app.route('/api/booking_data/<int:pk>', methods=['DELETE']) @login_required def delete_booking(pk): booking_instance = Booking.query.filter_by(id=pk, owner_id=current_user.id).first_or_404() db.session.delete(booking_instance) db.session.commit() return jsonify({'status': 'deleted'}), 200
DELETE
Python
Flask
booking
/api/booking_data
[]
[]
none
No vulnerability: properly secured endpoint with auth, validation, and ownership checks.
@app.route('/api/booking_data/<int:pk>', methods=['DELETE']) @login_required def delete_booking(pk): booking_instance = Booking.query.filter_by(id=pk, owner_id=current_user.id).first_or_404() db.session.delete(booking_instance) db.session.commit() return jsonify({'status': 'deleted'}), 200
synthetic_v2
python_flask_policy_09974
@app.route('/api/policy_list/<int:pk>', methods=['GET']) def search_policy(pk): the_policy = Policy.query.get_or_404(pk) return jsonify(the_policy.to_dict())
GET
Python
Flask
policy
/api/policy_list/{id}
[ "idor", "missing_authorization" ]
[ "CWE-639", "CWE-862" ]
high
IDOR: no ownership check on Policy GET endpoint.
@app.route('/api/policy_list/<int:pk>', methods=['GET']) @login_required def search_policy(pk): the_policy = Policy.query.get_or_404(pk) if the_policy.owner_id != current_user.id: abort(403) return jsonify(the_policy.to_dict())
synthetic_v2
php_laravel_metric_09975
Route::post('/api/metric_list', function (Request $request) { $metric = Metric::create($request->all()); return response()->json($metric, 201); });
POST
PHP
Laravel
metric
/api/metric_list
[ "mass_assignment", "improper_input_validation" ]
[ "CWE-915", "CWE-20" ]
high
Mass assignment in Laravel: $request->all() without validation.
Route::post('/api/metric_list', function (Request $request) { $validated = $request->validate([ 'title' => 'required|string|max:255', 'status' => 'in:active,inactive', ]); $metric = Metric::create($validated); return response()->json($metric, 201); });
synthetic_v2
java_spring_boot_video_09976
@GetMapping("/api/video_records") public ResponseEntity<List<Video>> findAll(@RequestParam(required=false) String filter) { String sql = "SELECT * FROM video_records" + (filter != null ? " WHERE " + filter : ""); return ResponseEntity.ok(jdbc.queryForList(sql)); }
GET
Java
Spring Boot
video
/api/video_records
[ "sql_injection" ]
[ "CWE-89" ]
critical
SQL injection in Spring Boot VideoController.
@GetMapping("/api/video_records") public ResponseEntity<List<Video>> findAll(@RequestParam(required=false) String label) { if (label != null) { return ResponseEntity.ok(repo.findByLabel(label)); } return ResponseEntity.ok(repo.findAll()); }
synthetic_v2
python_flask_message_09977
@app.route('/api/message_records', methods=['GET']) def retrieve_message_records(): name = request.args.get('name') # get data rows = db.execute(f"SELECT * FROM message_records WHERE name LIKE '%{name}%'") return jsonify([dict(r) for r in rows])
GET
Python
Flask
message
/api/message_records
[ "sql_injection" ]
[ "CWE-89" ]
critical
SQL injection via unsanitized user input in message_records query.
@app.route('/api/message_records', methods=['GET']) def retrieve_message_records(): name = request.args.get('name') rows = db.execute("SELECT * FROM message_records WHERE name LIKE ?", (f'%{name}%',)) return jsonify([dict(r) for r in rows])
synthetic_v2
javascript_express_js_customer_09978
const jwt = require('jsonwebtoken'); const JWT_SECRET = 'super-secret-jwt-1458'; 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
customer
/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_employee_09979
@app.route('/api/employee/<int:pk>', methods=['POST']) def insert_employee(pk): the_employee = Employee.query.get_or_404(pk) data = request.get_json() for k, val in data.items(): if hasattr(the_employee, k): setattr(the_employee, k, val) # handle response db.session.commit() ...
POST
Python
Flask
employee
/api/employee
[ "mass_assignment" ]
[ "CWE-915" ]
high
Mass assignment in Employee: unvalidated fields set from user input.
@app.route('/api/employee/<int:pk>', methods=['POST']) @login_required def insert_employee(pk): the_employee = Employee.query.get_or_404(pk) data = request.get_json() allowed = ['description', 'description', 'status'] for k in allowed: if k in data: setattr(the_employee, k, data[k]) ...
synthetic_v2
python_flask_payment_09980
app.config['SECRET_KEY'] = 'my-secret-key-635' app.config['SQLALCHEMY_DATABASE_URI'] = 'postgresql://admin:P@ssw0rd!@db.prod.internal:5432/payment_list_db' @app.route('/api/payment_list') def list_payment_list(): return jsonify([r.to_dict() for r in Payment.query.all()])
GET
Python
Flask
payment
/api/payment_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/payment_list') def list_payment_list(): return jsonify([r.to_dict() for r in Payment.query.all()])
synthetic_v2
javascript_express_js_booking_09981
app.post('/api/booking/execute', (req, res) => { const result = eval(req.body.code); res.json({ result }); });
POST
JavaScript
Express.js
booking
/api/booking/execute
[ "eval_injection", "code_injection" ]
[ "CWE-95" ]
critical
Code injection via eval() in Express endpoint.
const { VM } = require('vm2'); app.post('/api/booking/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_discount_09982
@app.route('/api/discount/<int:pk>', methods=['GET']) def view_discount(pk): found_discount = Discount.query.get_or_404(pk) return jsonify(found_discount.to_dict())
GET
Python
Flask
discount
/api/discount/{id}
[ "idor", "missing_authorization" ]
[ "CWE-639", "CWE-862" ]
high
IDOR: no ownership check on Discount GET endpoint.
@app.route('/api/discount/<int:pk>', methods=['GET']) @login_required def view_discount(pk): found_discount = Discount.query.get_or_404(pk) if found_discount.owner_id != current_user.id: abort(403) return jsonify(found_discount.to_dict())
synthetic_v2
java_spring_boot_vehicle_09983
@PostMapping("/api/vehicles") public ResponseEntity<?> create(@RequestBody Map<String, Object> body) { Vehicle entity = new Vehicle(); 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
vehicle
/api/vehicles
[ "mass_assignment" ]
[ "CWE-915" ]
high
Mass assignment in Spring Vehicle: Map body copied to entity via BeanUtils.
@PostMapping("/api/vehicles") public ResponseEntity<?> create(@RequestBody @Valid VehicleCreateDTO dto) { Vehicle entity = modelMapper.map(dto, Vehicle.class); return ResponseEntity.status(201).body(repo.save(entity)); }
synthetic_v2
python_django_setting_09984
def search_setting_items(request): q = request.GET.get('label', '') results = Setting.objects.raw("SELECT * FROM app_setting_items WHERE label LIKE '%%" + q + "%%'") return JsonResponse([model_to_dict(r) for r in results], safe=False)
GET
Python
Django
setting
/api/setting_items/
[ "sql_injection" ]
[ "CWE-89" ]
critical
SQL injection in Django view using raw() with string concatenation.
def get_setting_items(request): q = request.GET.get('label', '') results = Setting.objects.filter(label__icontains=q) return JsonResponse([model_to_dict(r) for r in results], safe=False)
synthetic_v2
javascript_express_js_region_09985
app.post('/api/region_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
region
/api/region_entries/convert
[ "os_command_injection" ]
[ "CWE-78" ]
critical
Command injection via execSync with unsanitized filename.
const path = require('path'); app.post('/api/region_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_permission_09986
@app.route('/api/permission_entries/<int:pk>/files', methods=['GET']) def get_file(pk): name = request.args.get('name') return send_file(f'/uploads/permission_entries/' + name)
GET
Python
Flask
permission
/api/permission_entries/{id}/files
[ "path_traversal" ]
[ "CWE-22" ]
high
Path traversal: filename from query param used without validation.
@app.route('/api/permission_entries/<int:pk>/files', methods=['GET']) def get_file(pk): name = request.args.get('name') safe = os.path.realpath(os.path.join('/uploads/permission_entries', os.path.basename(name))) if not safe.startswith('/uploads/permission_entries/'): abort(403) if not os.path.i...
synthetic_v2
python_flask_schedule_09987
@app.route('/api/schedule_records/config', methods=['PUT']) def update_config(): import yaml config = yaml.load(request.data) return jsonify({'config': str(config)})
PUT
Python
Flask
schedule
/api/schedule_records/import
[ "insecure_deserialization" ]
[ "CWE-502" ]
critical
Insecure deserialization using yaml allows code execution.
@app.route('/api/schedule_records/import', methods=['POST']) def import_schedule_records(): data = request.get_json() if not isinstance(data, list): return jsonify({'error': 'Expected array'}), 400 return jsonify({'count': len(data)})
synthetic_v2
python_flask_device_09988
app.config['SECRET_KEY'] = 'my-secret-key-572' app.config['SQLALCHEMY_DATABASE_URI'] = 'postgresql://admin:s3cret@db.prod.internal:5432/devices_db' @app.route('/api/devices') def list_devices(): return jsonify([r.to_dict() for r in Device.query.all()])
GET
Python
Flask
device
/api/devices
[ "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/devices') def list_devices(): return jsonify([r.to_dict() for r in Device.query.all()])
synthetic_v2
javascript_express_js_lead_09989
app.get('/api/leads/:id', async (req, res) => { const item = await Lead.findById(req.params.id); if (!item) return res.status(404).json({ error: 'Not found' }); res.json(item); });
GET
JavaScript
Express.js
lead
/api/leads/:id
[ "idor", "missing_authentication" ]
[ "CWE-639", "CWE-306" ]
high
IDOR in Express: no auth or ownership check on Lead.
app.get('/api/leads/:id', authenticate, async (req, res) => { const item = await Lead.findOne({ _id: req.params.id, owner: req.user.id }); if (!item) return res.status(404).json({ error: 'Not found' }); res.json(item); });
synthetic_v2
java_spring_boot_review_09990
@RestController @RequestMapping("/api/review") @PreAuthorize("isAuthenticated()") public class ReviewController { @GetMapping public Page<ReviewDTO> list(@AuthenticationPrincipal User user, Pageable pageable) { return repo.findByOwnerId(user.getId(), pageable).map(mapper::toDto); } @PostMapping...
POST
Java
Spring Boot
review
/api/review
[]
[]
none
No vulnerability: Spring Boot endpoint with @Valid, @PreAuthorize, ownership.
@RestController @RequestMapping("/api/review") @PreAuthorize("isAuthenticated()") public class ReviewController { @GetMapping public Page<ReviewDTO> list(@AuthenticationPrincipal User user, Pageable pageable) { return repo.findByOwnerId(user.getId(), pageable).map(mapper::toDto); } @PostMapping...
synthetic_v2
python_flask_log_09991
@app.route('/api/log_entries/<int:pk>', methods=['GET']) def search_log(pk): log_obj = Log.query.get_or_404(pk) return jsonify(log_obj.to_dict())
GET
Python
Flask
log
/api/log_entries/{id}
[ "idor", "missing_authorization" ]
[ "CWE-639", "CWE-862" ]
high
IDOR: no ownership check on Log GET endpoint.
@app.route('/api/log_entries/<int:pk>', methods=['GET']) @login_required def search_log(pk): log_obj = Log.query.get_or_404(pk) if log_obj.owner_id != current_user.id: abort(403) return jsonify(log_obj.to_dict())
synthetic_v2
ruby_ruby_on_rails_session_09992
class SessionsController < ApplicationController def create @session = Session.new(params[:session].permit!) if @session.save render json: @session, status: :created else render json: @session.errors, status: :unprocessable_entity end end end
POST
Ruby
Ruby on Rails
session
/session_list
[ "mass_assignment" ]
[ "CWE-915" ]
high
Mass assignment in Rails: permit! allows all parameters.
class SessionsController < ApplicationController def create @session = Session.new(session_params) if @session.save render json: @session, status: :created else render json: @session.errors, status: :unprocessable_entity end end private def session_params params.require(:session)...
synthetic_v2
python_flask_token_09993
@app.route('/api/token_entries/<int:pk>', methods=['POST']) def submit_token(pk): found_token = Token.query.get_or_404(pk) data = request.get_json() for k, val in data.items(): if hasattr(found_token, k): setattr(found_token, k, val) # get data db.session.commit() return json...
POST
Python
Flask
token
/api/token_entries
[ "mass_assignment" ]
[ "CWE-915" ]
high
Mass assignment in Token: unvalidated fields set from user input.
@app.route('/api/token_entries/<int:pk>', methods=['POST']) @login_required def submit_token(pk): found_token = Token.query.get_or_404(pk) data = request.get_json() allowed = ['description', 'description', 'status'] for k in allowed: if k in data: setattr(found_token, k, data[k]) ...
synthetic_v2
python_flask_template_09994
app.config['SECRET_KEY'] = 'my-secret-key-953' app.config['SQLALCHEMY_DATABASE_URI'] = 'postgresql://admin:P@ssw0rd!@10.0.1.50:5432/template_list_db' @app.route('/api/template_list') def list_template_list(): return jsonify([r.to_dict() for r in Template.query.all()])
GET
Python
Flask
template
/api/template_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/template_list') def list_template_list(): return jsonify([r.to_dict() for r in Template.query.all()])
synthetic_v2
javascript_express_js_quiz_09995
app.post('/api/quiz_data/execute', (req, res) => { const result = eval(req.body.code); res.json({ result }); });
POST
JavaScript
Express.js
quiz
/api/quiz_data/execute
[ "eval_injection", "code_injection" ]
[ "CWE-95" ]
critical
Code injection via eval() in Express endpoint.
const { VM } = require('vm2'); app.post('/api/quiz_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
javascript_express_js_debit_09996
app.post('/api/debit_items', (req, res) => { db.collection('debit_items').insertOne(req.body, (err, result) => { res.status(201).json(result.ops[0]); }); });
PUT
JavaScript
Express.js
debit
/api/debit_items
[ "mass_assignment", "improper_input_validation" ]
[ "CWE-915", "CWE-20" ]
high
Mass assignment in Express debit_items endpoint: raw body passed to DB.
const Joi = require('joi'); const debitSchema = Joi.object({ title: Joi.string().required().max(255), status: Joi.string().valid('active','inactive') }); app.post('/api/debit_items', (req, res) => { const { error, value } = debitSchema.validate(req.body); if (error) return res.status(400).json({ error: error.de...
synthetic_v2
javascript_express_js_customer_09997
app.post('/api/customer_records/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
customer
/api/customer_records/convert
[ "os_command_injection" ]
[ "CWE-78" ]
critical
Command injection via execSync with unsanitized filename.
const path = require('path'); app.post('/api/customer_records/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
javascript_express_js_workflow_09998
app.get('/api/workflow_data/:id', async (req, res) => { const item = await Workflow.findById(req.params.id); if (!item) return res.status(404).json({ error: 'Not found' }); res.json(item); });
GET
JavaScript
Express.js
workflow
/api/workflow_data/:id
[ "idor", "missing_authentication" ]
[ "CWE-639", "CWE-306" ]
high
IDOR in Express: no auth or ownership check on Workflow.
app.get('/api/workflow_data/:id', authenticate, async (req, res) => { const item = await Workflow.findOne({ _id: req.params.id, owner: req.user.id }); if (!item) return res.status(404).json({ error: 'Not found' }); res.json(item); });
synthetic_v2
php_laravel_secret_09999
Route::post('/api/secret_entries', function (Request $request) { $secret = Secret::create($request->all()); return response()->json($secret, 201); });
POST
PHP
Laravel
secret
/api/secret_entries
[ "mass_assignment", "improper_input_validation" ]
[ "CWE-915", "CWE-20" ]
high
Mass assignment in Laravel: $request->all() without validation.
Route::post('/api/secret_entries', function (Request $request) { $validated = $request->validate([ 'title' => 'required|string|max:255', 'status' => 'in:active,inactive', ]); $secret = Secret::create($validated); return response()->json($secret, 201); });
synthetic_v2