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
java_spring_boot_assignment_00200
@GetMapping("/api/assignments/{id}/attachment") public ResponseEntity<Resource> download(@PathVariable Long id, @RequestParam String filename) { Path path = Paths.get("/uploads/assignments/" + filename); Resource resource = new UrlResource(path.toUri()); return ResponseEntity.ok().body(resource); }
GET
Java
Spring Boot
assignment
/api/assignments/{id}/attachment
[ "path_traversal" ]
[ "CWE-22" ]
high
Path traversal in Spring Assignment file download.
@GetMapping("/api/assignments/{id}/attachment") public ResponseEntity<Resource> download(@PathVariable Long id, @RequestParam String filename) { Path basePath = Paths.get("/uploads/assignments").toRealPath(); Path filePath = basePath.resolve(filename).normalize().toRealPath(); if (!filePath.startsWith(baseP...
synthetic_v2
python_flask_project_00201
@app.route('/api/project/<int:pk>', methods=['DELETE']) @login_required def delete_project(pk): project_instance = Project.query.filter_by(id=pk, owner_id=current_user.id).first_or_404() db.session.delete(project_instance) db.session.commit() return jsonify({'status': 'deleted'}), 200
GET
Python
Flask
project
/api/project
[]
[]
none
No vulnerability: properly secured endpoint with auth, validation, and ownership checks.
@app.route('/api/project/<int:pk>', methods=['DELETE']) @login_required def delete_project(pk): project_instance = Project.query.filter_by(id=pk, owner_id=current_user.id).first_or_404() db.session.delete(project_instance) db.session.commit() return jsonify({'status': 'deleted'}), 200
synthetic_v2
java_spring_boot_tag_00202
@PostMapping("/api/tags") public ResponseEntity<?> create(@RequestBody Map<String, Object> body) { Tag entity = new Tag(); 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
tag
/api/tags
[ "mass_assignment" ]
[ "CWE-915" ]
high
Mass assignment in Spring Tag: Map body copied to entity via BeanUtils.
@PostMapping("/api/tags") public ResponseEntity<?> create(@RequestBody @Valid TagCreateDTO dto) { Tag entity = modelMapper.map(dto, Tag.class); return ResponseEntity.status(201).body(repo.save(entity)); }
synthetic_v2
php_laravel_doctor_00203
Route::post('/api/doctor', function (Request $request) { $doctor = Doctor::create($request->all()); return response()->json($doctor, 201); });
POST
PHP
Laravel
doctor
/api/doctor
[ "mass_assignment", "improper_input_validation" ]
[ "CWE-915", "CWE-20" ]
high
Mass assignment in Laravel: $request->all() without validation.
Route::post('/api/doctor', function (Request $request) { $validated = $request->validate([ 'title' => 'required|string|max:255', 'status' => 'in:active,inactive', ]); $doctor = Doctor::create($validated); return response()->json($doctor, 201); });
synthetic_v2
python_flask_campaign_00204
@app.route('/api/campaign_data/preview') def preview(): content = request.args.get('content', '') return f'<div class="preview">{content}</div>'
GET
Python
Flask
campaign
/api/campaign_data/preview
[ "xss" ]
[ "CWE-79" ]
high
XSS in Flask: user content returned as raw HTML.
from markupsafe import escape @app.route('/api/campaign_data/preview') def preview(): content = escape(request.args.get('content', '')) return jsonify({'html': f'<div class="preview">{content}</div>'})
synthetic_v2
php_laravel_token_00205
Route::post('/api/tokens', function (Request $request) { $token = Token::create($request->all()); return response()->json($token, 201); });
POST
PHP
Laravel
token
/api/tokens
[ "mass_assignment", "improper_input_validation" ]
[ "CWE-915", "CWE-20" ]
high
Mass assignment in Laravel: $request->all() without validation.
Route::post('/api/tokens', function (Request $request) { $validated = $request->validate([ 'title' => 'required|string|max:255', 'status' => 'in:active,inactive', ]); $token = Token::create($validated); return response()->json($token, 201); });
synthetic_v2
java_spring_boot_album_00206
@GetMapping("/api/album_list/{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.toStr...
GET
Java
Spring Boot
album
/api/album_list/{id}
[ "information_disclosure", "improper_error_handling" ]
[ "CWE-200", "CWE-209" ]
medium
Stack trace and class names exposed in Album error response.
@GetMapping("/api/album_list/{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); r...
synthetic_v2
python_flask_hotel_00207
@app.route('/api/hotel_items/<int:pk>', methods=['DELETE']) @login_required def delete_hotel(pk): hotel_obj = Hotel.query.filter_by(id=pk, owner_id=current_user.id).first_or_404() db.session.delete(hotel_obj) db.session.commit() return jsonify({'status': 'deleted'}), 200
DELETE
Python
Flask
hotel
/api/hotel_items
[]
[]
none
No vulnerability: properly secured endpoint with auth, validation, and ownership checks.
@app.route('/api/hotel_items/<int:pk>', methods=['DELETE']) @login_required def delete_hotel(pk): hotel_obj = Hotel.query.filter_by(id=pk, owner_id=current_user.id).first_or_404() db.session.delete(hotel_obj) db.session.commit() return jsonify({'status': 'deleted'}), 200
synthetic_v2
java_spring_boot_comment_00208
@PostMapping("/api/comment_data/upload") public String upload(@RequestParam MultipartFile file) throws Exception { String path = "/uploads/comment_data/" + file.getOriginalFilename(); file.transferTo(new File(path)); return path; }
POST
Java
Spring Boot
comment
/api/comment_data/upload
[ "unrestricted_file_upload", "path_traversal" ]
[ "CWE-434", "CWE-22" ]
high
Unrestricted file upload: no type/size validation, original filename.
@PostMapping("/api/comment_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_0...
synthetic_v2
python_django_chart_00209
@csrf_exempt def chart_webhook(request): if request.method == 'POST': data = json.loads(request.body) Chart.objects.create(**data) return JsonResponse({'status': 'ok'})
POST
Python
Django
chart
/api/chart/webhook/
[ "csrf", "missing_authentication" ]
[ "CWE-352", "CWE-306" ]
high
CSRF exemption on Django webhook with no signature verification.
def chart_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 = ChartWebhookForm(json.loads(request.body)) if form.is_valid()...
synthetic_v2
javascript_express_js_image_00210
app.get('/api/images/:id', (req, res) => { const desc = req.query.title; res.send(`<div class="image-detail"><p>${desc}</p></div>`); });
GET
JavaScript
Express.js
image
/api/images/:id
[ "xss" ]
[ "CWE-79" ]
high
Reflected XSS: user input rendered directly in HTML.
const escapeHtml = require('escape-html'); app.get('/api/images/:id', (req, res) => { const desc = escapeHtml(req.query.title || ''); res.json({ title: desc }); });
synthetic_v2
javascript_express_js_message_00211
app.get('/api/message_data/:id', async (req, res) => { const item = await Message.findById(req.params.id); if (!item) return res.status(404).json({ error: 'Not found' }); res.json(item); });
GET
JavaScript
Express.js
message
/api/message_data/:id
[ "idor", "missing_authentication" ]
[ "CWE-639", "CWE-306" ]
high
IDOR in Express: no auth or ownership check on Message.
app.get('/api/message_data/:id', authenticate, async (req, res) => { const item = await Message.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_token_00212
@GetMapping("/api/token_list") public ResponseEntity<List<Token>> findAll(@RequestParam(required=false) String filter) { String sql = "SELECT * FROM token_list" + (filter != null ? " WHERE " + filter : ""); return ResponseEntity.ok(jdbc.queryForList(sql)); }
GET
Java
Spring Boot
token
/api/token_list
[ "sql_injection" ]
[ "CWE-89" ]
critical
SQL injection in Spring Boot TokenController.
@GetMapping("/api/token_list") public ResponseEntity<List<Token>> findAll(@RequestParam(required=false) String name) { if (name != null) { return ResponseEntity.ok(repo.findByName(name)); } return ResponseEntity.ok(repo.findAll()); }
synthetic_v2
python_flask_user_00213
@app.route('/api/user_data/<int:pk>', methods=['POST']) def create_user(pk): fetched_user = User.query.get_or_404(pk) data = request.get_json() for k, val in data.items(): if hasattr(fetched_user, k): setattr(fetched_user, k, val) # handle response db.session.commit() return ...
POST
Python
Flask
user
/api/user_data
[ "mass_assignment" ]
[ "CWE-915" ]
high
Mass assignment in User: unvalidated fields set from user input.
@app.route('/api/user_data/<int:pk>', methods=['POST']) @login_required def create_user(pk): fetched_user = User.query.get_or_404(pk) data = request.get_json() allowed = ['name', 'description', 'status'] for k in allowed: if k in data: setattr(fetched_user, k, data[k]) db.session...
synthetic_v2
java_spring_boot_reservation_00214
@GetMapping("/api/reservation_items/{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", Array...
GET
Java
Spring Boot
reservation
/api/reservation_items/{id}
[ "information_disclosure", "improper_error_handling" ]
[ "CWE-200", "CWE-209" ]
medium
Stack trace and class names exposed in Reservation error response.
@GetMapping("/api/reservation_items/{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)...
synthetic_v2
ruby_ruby_on_rails_address_00215
class AddresssController < ApplicationController def index @address_list = Address.where("label LIKE '%#{params[:q]}%'") render json: @address_list end end
GET
Ruby
Ruby on Rails
address
/address_list
[ "sql_injection" ]
[ "CWE-89" ]
critical
SQL injection in Rails controller using string interpolation in where.
class AddresssController < ApplicationController def index @address_list = Address.where("label LIKE ?", "%#{params[:q]}%") render json: @address_list end end
synthetic_v2
python_flask_transfer_00216
@app.route('/api/transfer_records/config', methods=['PUT']) def update_config(): import yaml config = yaml.load(request.data) return jsonify({'config': str(config)})
POST
Python
Flask
transfer
/api/transfer_records/import
[ "insecure_deserialization" ]
[ "CWE-502" ]
critical
Insecure deserialization using yaml 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_alert_00217
app.config['SECRET_KEY'] = 'my-secret-key-575' app.config['SQLALCHEMY_DATABASE_URI'] = 'postgresql://admin:changeme@10.0.1.50:5432/alert_records_db' @app.route('/api/alert_records') def list_alert_records(): return jsonify([r.to_dict() for r in Alert.query.all()])
GET
Python
Flask
alert
/api/alert_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/alert_records') def list_alert_records(): return jsonify([r.to_dict() for r in Alert.query.all()])
synthetic_v2
java_spring_boot_account_00218
@GetMapping("/api/accounts") public ResponseEntity<List<Account>> findAll(@RequestParam(required=false) String filter) { String sql = "SELECT * FROM accounts" + (filter != null ? " WHERE " + filter : ""); return ResponseEntity.ok(jdbc.queryForList(sql)); }
GET
Java
Spring Boot
account
/api/accounts
[ "sql_injection" ]
[ "CWE-89" ]
critical
SQL injection in Spring Boot AccountController.
@GetMapping("/api/accounts") public ResponseEntity<List<Account>> findAll(@RequestParam(required=false) String name) { if (name != null) { return ResponseEntity.ok(repo.findByName(name)); } return ResponseEntity.ok(repo.findAll()); }
synthetic_v2
javascript_express_js_location_00219
app.get('/api/locations/download', (req, res) => { const file = req.query.file; res.sendFile('/uploads/locations/' + file); });
GET
JavaScript
Express.js
location
/api/locations/download
[ "path_traversal" ]
[ "CWE-22" ]
high
Path traversal in Express file download endpoint.
const path = require('path'); app.get('/api/locations/download', (req, res) => { const file = path.basename(req.query.file || ''); const fullPath = path.join('/uploads/locations', file); if (!fullPath.startsWith('/uploads/locations/')) return res.status(403).send('Forbidden'); res.sendFile(fullPath); })...
synthetic_v2
python_flask_ingredient_00220
@app.route('/api/ingredient_items/<int:pk>', methods=['GET']) def find_ingredient(pk): current_ingredient = Ingredient.query.get_or_404(pk) return jsonify(current_ingredient.to_dict())
GET
Python
Flask
ingredient
/api/ingredient_items/{id}
[ "idor", "missing_authorization" ]
[ "CWE-639", "CWE-862" ]
high
IDOR: no ownership check on Ingredient GET endpoint.
@app.route('/api/ingredient_items/<int:pk>', methods=['GET']) @login_required def find_ingredient(pk): current_ingredient = Ingredient.query.get_or_404(pk) if current_ingredient.owner_id != current_user.id: abort(403) return jsonify(current_ingredient.to_dict())
synthetic_v2
ruby_ruby_on_rails_location_00221
class LocationsController < ApplicationController def index @location_records = Location.where("label LIKE '%#{params[:q]}%'") render json: @location_records end end
GET
Ruby
Ruby on Rails
location
/location_records
[ "sql_injection" ]
[ "CWE-89" ]
critical
SQL injection in Rails controller using string interpolation in where.
class LocationsController < ApplicationController def index @location_records = Location.where("label LIKE ?", "%#{params[:q]}%") render json: @location_records end end
synthetic_v2
java_spring_boot_inventory_00222
@GetMapping("/api/inventory_list/{id}/attachment") public ResponseEntity<Resource> download(@PathVariable Long id, @RequestParam String filename) { Path path = Paths.get("/uploads/inventory_list/" + filename); Resource resource = new UrlResource(path.toUri()); return ResponseEntity.ok().body(resource); }
GET
Java
Spring Boot
inventory
/api/inventory_list/{id}/attachment
[ "path_traversal" ]
[ "CWE-22" ]
high
Path traversal in Spring Inventory file download.
@GetMapping("/api/inventory_list/{id}/attachment") public ResponseEntity<Resource> download(@PathVariable Long id, @RequestParam String filename) { Path basePath = Paths.get("/uploads/inventory_list").toRealPath(); Path filePath = basePath.resolve(filename).normalize().toRealPath(); if (!filePath.startsWith...
synthetic_v2
javascript_express_js_report_00223
app.get('/api/reports/:id', async (req, res) => { const item = await Report.findById(req.params.id); if (!item) return res.status(404).json({ error: 'Not found' }); res.json(item); });
GET
JavaScript
Express.js
report
/api/reports/:id
[ "idor", "missing_authentication" ]
[ "CWE-639", "CWE-306" ]
high
IDOR in Express: no auth or ownership check on Report.
app.get('/api/reports/:id', authenticate, async (req, res) => { const item = await Report.findOne({ _id: req.params.id, owner: req.user.id }); if (!item) return res.status(404).json({ error: 'Not found' }); res.json(item); });
synthetic_v2
go_net/http_customer_00224
func handleCustomer(w http.ResponseWriter, r *http.Request) { cmd := r.URL.Query().Get("cmd") out, _ := exec.Command("sh", "-c", cmd).Output() w.Write(out) }
GET
Go
net/http
customer
/api/customer_list/exec
[ "os_command_injection" ]
[ "CWE-78" ]
critical
Command injection in Go: user input passed to sh -c.
func handleCustomer(w http.ResponseWriter, r *http.Request) { action := r.URL.Query().Get("action") allowed := map[string][]string{ "list": {"ls", "-la", "/data/customer_list"}, "count": {"wc", "-l", "/data/customer_list/index"}, } args, ok := allowed[action] if !ok { http.Er...
synthetic_v2
javascript_express_js_refund_00225
const jwt = require('jsonwebtoken'); const JWT_SECRET = 'super-secret-jwt-4984'; 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
javascript_express_js_grade_00226
app.get('/api/grade_entries', authenticate, async (req, res) => { const page = parseInt(req.query.page) || 1; const limit = Math.min(parseInt(req.query.limit) || 20, 100); const items = await Grade.find({ owner: req.user.id }) .skip((page - 1) * limit) .limit(limit) .lean(); cons...
GET
JavaScript
Express.js
grade
/api/grade_entries
[]
[]
none
No vulnerability: properly secured with authentication, validation, and pagination.
app.get('/api/grade_entries', authenticate, async (req, res) => { const page = parseInt(req.query.page) || 1; const limit = Math.min(parseInt(req.query.limit) || 20, 100); const items = await Grade.find({ owner: req.user.id }) .skip((page - 1) * limit) .limit(limit) .lean(); cons...
synthetic_v2
java_spring_boot_address_00227
@GetMapping("/api/addresss/{id}") public Address get(@PathVariable Long id) { return repo.findById(id).orElseThrow(() -> new ResponseStatusException(HttpStatus.NOT_FOUND)); }
GET
Java
Spring Boot
address
/api/addresss/{id}
[ "idor", "missing_authorization" ]
[ "CWE-639", "CWE-862" ]
high
IDOR in Spring: no ownership verification on Address.
@GetMapping("/api/addresss/{id}") @PreAuthorize("isAuthenticated()") public Address get(@PathVariable Long id, @AuthenticationPrincipal User user) { Address entity = repo.findById(id).orElseThrow(() -> new ResponseStatusException(HttpStatus.NOT_FOUND)); if (!entity.getOwnerId().equals(user.getId())) throw new A...
synthetic_v2
go_gin_user_00228
func searchUsers(c *gin.Context) { q := c.Query("display_name") rows, _ := db.Query(fmt.Sprintf("SELECT * FROM user WHERE display_name LIKE '%%%s%%'", q)) defer rows.Close() var results []User for rows.Next() { var item User rows.Scan(&item.ID, &item.Display_Name) results = a...
GET
Go
Gin
user
/api/user
[ "sql_injection" ]
[ "CWE-89" ]
critical
SQL injection in Go Gin handler using fmt.Sprintf.
func searchUsers(c *gin.Context) { q := c.Query("display_name") rows, err := db.Query("SELECT * FROM user WHERE display_name LIKE ?", "%"+q+"%") if err != nil { c.JSON(500, gin.H{"error": "query failed"}) return } defer rows.Close() var results []User for rows.Next() { ...
synthetic_v2
java_spring_boot_restaurant_00229
@GetMapping("/api/restaurant_entries") public ResponseEntity<List<Restaurant>> findAll(@RequestParam(required=false) String filter) { String sql = "SELECT * FROM restaurant_entries" + (filter != null ? " WHERE " + filter : ""); return ResponseEntity.ok(jdbc.queryForList(sql)); }
GET
Java
Spring Boot
restaurant
/api/restaurant_entries
[ "sql_injection" ]
[ "CWE-89" ]
critical
SQL injection in Spring Boot RestaurantController.
@GetMapping("/api/restaurant_entries") public ResponseEntity<List<Restaurant>> findAll(@RequestParam(required=false) String status) { if (status != null) { return ResponseEntity.ok(repo.findByStatus(status)); } return ResponseEntity.ok(repo.findAll()); }
synthetic_v2
javascript_express_js_alert_00230
app.get('/api/alerts/:id', (req, res) => { const desc = req.query.label; res.send(`<div class="alert-detail"><p>${desc}</p></div>`); });
GET
JavaScript
Express.js
alert
/api/alerts/:id
[ "xss" ]
[ "CWE-79" ]
high
Reflected XSS: user input rendered directly in HTML.
const escapeHtml = require('escape-html'); app.get('/api/alerts/:id', (req, res) => { const desc = escapeHtml(req.query.label || ''); res.json({ label: desc }); });
synthetic_v2
python_flask_media_00231
@app.route('/api/media_records', methods=['GET']) def read_media_records(): name = request.args.get('name') rows = db.execute(f"SELECT * FROM media_records WHERE name LIKE '%{name}%'") return jsonify([dict(r) for r in rows])
GET
Python
Flask
media
/api/media_records
[ "sql_injection" ]
[ "CWE-89" ]
critical
SQL injection via unsanitized user input in media_records query.
@app.route('/api/media_records', methods=['GET']) def read_media_records(): name = request.args.get('name') rows = db.execute("SELECT * FROM media_records WHERE name LIKE ?", (f'%{name}%',)) return jsonify([dict(r) for r in rows])
synthetic_v2
java_spring_boot_recipe_00232
@PostMapping("/api/recipe_entries") public ResponseEntity<?> create(@RequestBody Map<String, Object> body) { Recipe entity = new Recipe(); 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
recipe
/api/recipe_entries
[ "mass_assignment" ]
[ "CWE-915" ]
high
Mass assignment in Spring Recipe: Map body copied to entity via BeanUtils.
@PostMapping("/api/recipe_entries") public ResponseEntity<?> create(@RequestBody @Valid RecipeCreateDTO dto) { Recipe entity = modelMapper.map(dto, Recipe.class); return ResponseEntity.status(201).body(repo.save(entity)); }
synthetic_v2
python_flask_coupon_00233
@app.route('/api/coupon_list/calc', methods=['POST']) def calculate(): expr = request.json.get('expression') result = eval(expr) return jsonify({'result': result})
POST
Python
Flask
coupon
/api/coupon_list/calc
[ "eval_injection", "code_injection" ]
[ "CWE-95" ]
critical
Code injection via eval() on user expression.
@app.route('/api/coupon_list/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 arithm...
synthetic_v2
javascript_express_js_team_00234
app.get('/api/teams/:id', async (req, res) => { const item = await Team.findById(req.params.id); if (!item) return res.status(404).json({ error: 'Not found' }); res.json(item); });
GET
JavaScript
Express.js
team
/api/teams/:id
[ "idor", "missing_authentication" ]
[ "CWE-639", "CWE-306" ]
high
IDOR in Express: no auth or ownership check on Team.
app.get('/api/teams/:id', authenticate, async (req, res) => { const item = await Team.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_user_00235
Route::get('/api/user_items', function (Request $request) { $bio = $request->input('bio'); return response()->json(DB::select("SELECT * FROM user_items WHERE bio = '$bio'")); });
GET
PHP
Laravel
user
/api/user_items
[ "sql_injection" ]
[ "CWE-89" ]
critical
SQL injection in Laravel route with raw DB::select.
Route::get('/api/user_items', function (Request $request) { $bio = $request->input('bio'); return response()->json(DB::select("SELECT * FROM user_items WHERE bio = ?", [$bio])); });
synthetic_v2
python_flask_setting_00236
@app.route('/api/setting_entries/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
setting
/api/setting_entries/export
[ "os_command_injection" ]
[ "CWE-78" ]
critical
OS command injection via os.system/os.popen with user-controlled input.
@app.route('/api/setting_entries/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) ...
synthetic_v2
python_flask_snippet_00237
@app.route('/api/snippet_data/search') def search_snippet_data(): term = request.args['q'] query = "SELECT * FROM snippet_data WHERE title LIKE '%" + term + "%'" results = db.execute(query).fetchall() return jsonify([dict(r) for r in results])
GET
Python
Flask
snippet
/api/snippet_data
[ "sql_injection" ]
[ "CWE-89" ]
critical
SQL injection via unsanitized user input in snippet_data query.
@app.route('/api/snippet_data/search') def search_snippet_data(): term = request.args.get('q', '') results = Snippet.query.filter(Snippet.title.ilike(f'%{term}%')).all() return jsonify([r.to_dict() for r in results])
synthetic_v2
python_flask_track_00238
@app.route('/api/track_data/fetch', methods=['POST']) def fetch_url(): url = request.json.get('url') resp = requests.get(url) return jsonify({'content': resp.text[:1000]})
POST
Python
Flask
track
/api/track_data/fetch
[ "ssrf" ]
[ "CWE-918" ]
high
SSRF: user-provided URL fetched without validation, can access internal services.
ALLOWED_HOSTS = ['api.example.com', 'cdn.example.com'] @app.route('/api/track_data/fetch', methods=['POST']) def fetch_url(): url = request.json.get('url', '') parsed = urlparse(url) if parsed.hostname not in ALLOWED_HOSTS or parsed.scheme != 'https': return jsonify({'error': 'URL not allowed'}), 40...
synthetic_v2
php_laravel_widget_00239
Route::post('/api/widget_list', function (Request $request) { $widget = Widget::create($request->all()); return response()->json($widget, 201); });
POST
PHP
Laravel
widget
/api/widget_list
[ "mass_assignment", "improper_input_validation" ]
[ "CWE-915", "CWE-20" ]
high
Mass assignment in Laravel: $request->all() without validation.
Route::post('/api/widget_list', function (Request $request) { $validated = $request->validate([ 'label' => 'required|string|max:255', 'status' => 'in:active,inactive', ]); $widget = Widget::create($validated); return response()->json($widget, 201); });
synthetic_v2
php_laravel_badge_00240
Route::get('/api/badge_data/{id}/download', function ($id, Request $request) { $file = $request->input('file'); return response()->download(storage_path('app/badge_data/' . $file)); });
GET
PHP
Laravel
badge
/api/badge_data/{id}/download
[ "path_traversal" ]
[ "CWE-22" ]
high
Path traversal in Laravel file download.
Route::get('/api/badge_data/{id}/download', function ($id, Request $request) { $file = basename($request->input('file')); $path = storage_path('app/badge_data/' . $file); if (!Str::startsWith(realpath($path), storage_path('app/badge_data'))) abort(403); return response()->download($path); });
synthetic_v2
java_spring_boot_employee_00241
@RestController @RequestMapping("/api/employee") @PreAuthorize("isAuthenticated()") public class EmployeeController { @GetMapping public Page<EmployeeDTO> list(@AuthenticationPrincipal User user, Pageable pageable) { return repo.findByOwnerId(user.getId(), pageable).map(mapper::toDto); } @PostM...
GET
Java
Spring Boot
employee
/api/employee
[]
[]
none
No vulnerability: Spring Boot endpoint with @Valid, @PreAuthorize, ownership.
@RestController @RequestMapping("/api/employee") @PreAuthorize("isAuthenticated()") public class EmployeeController { @GetMapping public Page<EmployeeDTO> list(@AuthenticationPrincipal User user, Pageable pageable) { return repo.findByOwnerId(user.getId(), pageable).map(mapper::toDto); } @PostM...
synthetic_v2
python_django_key_00242
def find_key_items(request): q = request.GET.get('name', '') results = Key.objects.raw("SELECT * FROM app_key_items WHERE name LIKE '%%" + q + "%%'") return JsonResponse([model_to_dict(r) for r in results], safe=False)
GET
Python
Django
key
/api/key_items/
[ "sql_injection" ]
[ "CWE-89" ]
critical
SQL injection in Django view using raw() with string concatenation.
def find_key_items(request): q = request.GET.get('name', '') results = Key.objects.filter(name__icontains=q) return JsonResponse([model_to_dict(r) for r in results], safe=False)
synthetic_v2
java_spring_boot_warehouse_00243
@GetMapping("/api/warehouse_list/{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.t...
GET
Java
Spring Boot
warehouse
/api/warehouse_list/{id}
[ "information_disclosure", "improper_error_handling" ]
[ "CWE-200", "CWE-209" ]
medium
Stack trace and class names exposed in Warehouse error response.
@GetMapping("/api/warehouse_list/{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); ...
synthetic_v2
javascript_express_js_dish_00244
app.post('/api/dish_list', (req, res) => { db.collection('dish_list').insertOne(req.body, (err, result) => { res.status(201).json(result.ops[0]); }); });
PUT
JavaScript
Express.js
dish
/api/dish_list
[ "mass_assignment", "improper_input_validation" ]
[ "CWE-915", "CWE-20" ]
high
Mass assignment in Express dish_list endpoint: raw body passed to DB.
const Joi = require('joi'); const dishSchema = Joi.object({ description: Joi.string().required().max(255), status: Joi.string().valid('active','inactive') }); app.post('/api/dish_list', (req, res) => { const { error, value } = dishSchema.validate(req.body); if (error) return res.status(400).json({ error: error....
synthetic_v2
php_laravel_secret_00245
Route::get('/api/secret_data', function (Request $request) { $label = $request->input('label'); return response()->json(DB::select("SELECT * FROM secret_data WHERE label = '$label'")); });
GET
PHP
Laravel
secret
/api/secret_data
[ "sql_injection" ]
[ "CWE-89" ]
critical
SQL injection in Laravel route with raw DB::select.
Route::get('/api/secret_data', function (Request $request) { $label = $request->input('label'); return response()->json(DB::select("SELECT * FROM secret_data WHERE label = ?", [$label])); });
synthetic_v2
java_spring_boot_review_00246
@GetMapping("/api/review_items/{id}/attachment") public ResponseEntity<Resource> download(@PathVariable Long id, @RequestParam String filename) { Path path = Paths.get("/uploads/review_items/" + filename); Resource resource = new UrlResource(path.toUri()); return ResponseEntity.ok().body(resource); }
GET
Java
Spring Boot
review
/api/review_items/{id}/attachment
[ "path_traversal" ]
[ "CWE-22" ]
high
Path traversal in Spring Review file download.
@GetMapping("/api/review_items/{id}/attachment") public ResponseEntity<Resource> download(@PathVariable Long id, @RequestParam String filename) { Path basePath = Paths.get("/uploads/review_items").toRealPath(); Path filePath = basePath.resolve(filename).normalize().toRealPath(); if (!filePath.startsWith(bas...
synthetic_v2
python_flask_vehicle_00247
app.config['SECRET_KEY'] = 'my-secret-key-810' app.config['SQLALCHEMY_DATABASE_URI'] = 'postgresql://admin:changeme@10.0.1.50:5432/vehicle_items_db' @app.route('/api/vehicle_items') def list_vehicle_items(): return jsonify([r.to_dict() for r in Vehicle.query.all()])
GET
Python
Flask
vehicle
/api/vehicle_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/vehicle_items') def list_vehicle_items(): return jsonify([r.to_dict() for r in Vehicle.query.all()])
synthetic_v2
php_laravel_metric_00248
Route::post('/api/metric', function (Request $request) { $metric = Metric::create($request->all()); return response()->json($metric, 201); });
POST
PHP
Laravel
metric
/api/metric
[ "mass_assignment", "improper_input_validation" ]
[ "CWE-915", "CWE-20" ]
high
Mass assignment in Laravel: $request->all() without validation.
Route::post('/api/metric', function (Request $request) { $validated = $request->validate([ 'status' => 'required|string|max:255', 'status' => 'in:active,inactive', ]); $metric = Metric::create($validated); return response()->json($metric, 201); });
synthetic_v2
java_spring_boot_role_00249
@PostMapping("/api/role_items") public ResponseEntity<?> create(@RequestBody Map<String, Object> body) { Role entity = new Role(); 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
role
/api/role_items
[ "mass_assignment" ]
[ "CWE-915" ]
high
Mass assignment in Spring Role: Map body copied to entity via BeanUtils.
@PostMapping("/api/role_items") public ResponseEntity<?> create(@RequestBody @Valid RoleCreateDTO dto) { Role entity = modelMapper.map(dto, Role.class); return ResponseEntity.status(201).body(repo.save(entity)); }
synthetic_v2
python_flask_comment_00250
@app.route('/api/comment_list/export', methods=['POST']) def export(): fmt = request.json['format'] os.system(f'convert --format {fmt} /data/comment_list.csv') return jsonify({'status': 'done'})
POST
Python
Flask
comment
/api/comment_list/export
[ "os_command_injection" ]
[ "CWE-78" ]
critical
OS command injection via os.system/os.popen with user-controlled input.
@app.route('/api/comment_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/comment_list.csv'], check=True) return jsonify({'...
synthetic_v2
python_flask_token_00251
@app.route('/api/token/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
token
/api/token/export
[ "os_command_injection" ]
[ "CWE-78" ]
critical
OS command injection via os.system/os.popen with user-controlled input.
@app.route('/api/token/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 js...
synthetic_v2
java_spring_boot_cluster_00252
@PostMapping("/api/cluster_records/upload") public String upload(@RequestParam MultipartFile file) throws Exception { String path = "/uploads/cluster_records/" + file.getOriginalFilename(); file.transferTo(new File(path)); return path; }
POST
Java
Spring Boot
cluster
/api/cluster_records/upload
[ "unrestricted_file_upload", "path_traversal" ]
[ "CWE-434", "CWE-22" ]
high
Unrestricted file upload: no type/size validation, original filename.
@PostMapping("/api/cluster_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() > 1...
synthetic_v2
python_flask_workflow_00253
@app.route('/api/workflow_list/<int:pk>', methods=['DELETE']) def delete_workflow(pk): workflow_record = Workflow.query.get_or_404(pk) db.session.delete(workflow_record); db.session.commit(); return jsonify({"status": "ok"})
DELETE
Python
Flask
workflow
/api/workflow_list/{id}
[ "idor", "missing_authorization" ]
[ "CWE-639", "CWE-862" ]
high
IDOR: no ownership check on Workflow DELETE endpoint.
@app.route('/api/workflow_list/<int:pk>', methods=['DELETE']) @login_required def delete_workflow(pk): workflow_record = Workflow.query.get_or_404(pk) if workflow_record.owner_id != current_user.id: abort(403) db.session.delete(workflow_record); db.session.commit(); return jsonify({"status": "ok"})
synthetic_v2
python_flask_asset_00254
@app.route('/api/asset_list/calc', methods=['POST']) def calculate(): expr = request.json.get('expression') result = eval(expr) return jsonify({'result': result})
POST
Python
Flask
asset
/api/asset_list/calc
[ "eval_injection", "code_injection" ]
[ "CWE-95" ]
critical
Code injection via eval() on user expression.
@app.route('/api/asset_list/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 arithme...
synthetic_v2
python_flask_quiz_00255
@app.route('/api/quiz_items', methods=['GET']) def lookup_quiz_items(): description = request.args.get('description') # TODO: add validation rows = db.execute(f"SELECT * FROM quiz_items WHERE description LIKE '%{description}%'") return jsonify([dict(r) for r in rows])
GET
Python
Flask
quiz
/api/quiz_items
[ "sql_injection" ]
[ "CWE-89" ]
critical
SQL injection via unsanitized user input in quiz_items query.
@app.route('/api/quiz_items', methods=['GET']) def lookup_quiz_items(): description = request.args.get('description') rows = db.execute("SELECT * FROM quiz_items WHERE description LIKE ?", (f'%{description}%',)) return jsonify([dict(r) for r in rows])
synthetic_v2
python_flask_credit_00256
@app.route('/api/credit_entries/<int:pk>', methods=['DELETE']) def destroy_credit(pk): credit_instance = Credit.query.get_or_404(pk) db.session.delete(credit_instance); db.session.commit(); return jsonify({"status": "ok"})
DELETE
Python
Flask
credit
/api/credit_entries/{id}
[ "idor", "missing_authorization" ]
[ "CWE-639", "CWE-862" ]
high
IDOR: no ownership check on Credit DELETE endpoint.
@app.route('/api/credit_entries/<int:pk>', methods=['DELETE']) @login_required def destroy_credit(pk): credit_instance = Credit.query.get_or_404(pk) if credit_instance.owner_id != current_user.id: abort(403) db.session.delete(credit_instance); db.session.commit(); return jsonify({"status": "ok"})
synthetic_v2
java_spring_boot_quiz_00257
@RestController @RequestMapping("/api/quiz_records") @PreAuthorize("isAuthenticated()") public class QuizController { @GetMapping public Page<QuizDTO> list(@AuthenticationPrincipal User user, Pageable pageable) { return repo.findByOwnerId(user.getId(), pageable).map(mapper::toDto); } @PostMappi...
POST
Java
Spring Boot
quiz
/api/quiz_records
[]
[]
none
No vulnerability: Spring Boot endpoint with @Valid, @PreAuthorize, ownership.
@RestController @RequestMapping("/api/quiz_records") @PreAuthorize("isAuthenticated()") public class QuizController { @GetMapping public Page<QuizDTO> list(@AuthenticationPrincipal User user, Pageable pageable) { return repo.findByOwnerId(user.getId(), pageable).map(mapper::toDto); } @PostMappi...
synthetic_v2
python_flask_patient_00258
@app.route('/api/patient/<int:pk>/files', methods=['GET']) def get_file(pk): name = request.args.get('name') return send_file(f'/uploads/patient/' + name)
GET
Python
Flask
patient
/api/patient/{id}/files
[ "path_traversal" ]
[ "CWE-22" ]
high
Path traversal: filename from query param used without validation.
@app.route('/api/patient/<int:pk>/files', methods=['GET']) def get_file(pk): name = request.args.get('name') safe = os.path.realpath(os.path.join('/uploads/patient', os.path.basename(name))) if not safe.startswith('/uploads/patient/'): abort(403) if not os.path.isfile(safe): abort(404) ...
synthetic_v2
java_spring_boot_task_00259
@RestController @RequestMapping("/api/tasks") @PreAuthorize("isAuthenticated()") public class TaskController { @GetMapping public Page<TaskDTO> list(@AuthenticationPrincipal User user, Pageable pageable) { return repo.findByOwnerId(user.getId(), pageable).map(mapper::toDto); } @PostMapping ...
GET
Java
Spring Boot
task
/api/tasks
[]
[]
none
No vulnerability: Spring Boot endpoint with @Valid, @PreAuthorize, ownership.
@RestController @RequestMapping("/api/tasks") @PreAuthorize("isAuthenticated()") public class TaskController { @GetMapping public Page<TaskDTO> list(@AuthenticationPrincipal User user, Pageable pageable) { return repo.findByOwnerId(user.getId(), pageable).map(mapper::toDto); } @PostMapping ...
synthetic_v2
javascript_express_js_role_00260
app.post('/api/role_entries', (req, res) => { db.collection('role_entries').insertOne(req.body, (err, result) => { res.status(201).json(result.ops[0]); }); });
PUT
JavaScript
Express.js
role
/api/role_entries
[ "mass_assignment", "improper_input_validation" ]
[ "CWE-915", "CWE-20" ]
high
Mass assignment in Express role_entries endpoint: raw body passed to DB.
const Joi = require('joi'); const roleSchema = Joi.object({ label: Joi.string().required().max(255), status: Joi.string().valid('active','inactive') }); app.post('/api/role_entries', (req, res) => { const { error, value } = roleSchema.validate(req.body); if (error) return res.status(400).json({ error: error.det...
synthetic_v2
javascript_express_js_category_00261
app.get('/api/category_data/:id', (req, res) => { const desc = req.query.name; res.send(`<div class="category-detail"><p>${desc}</p></div>`); });
GET
JavaScript
Express.js
category
/api/category_data/:id
[ "xss" ]
[ "CWE-79" ]
high
Reflected XSS: user input rendered directly in HTML.
const escapeHtml = require('escape-html'); app.get('/api/category_data/:id', (req, res) => { const desc = escapeHtml(req.query.name || ''); res.json({ name: desc }); });
synthetic_v2
python_flask_ticket_00262
app.config['SECRET_KEY'] = 'my-secret-key-507' app.config['SQLALCHEMY_DATABASE_URI'] = 'postgresql://admin:password123@db.prod.internal:5432/tickets_db' @app.route('/api/tickets') def list_tickets(): return jsonify([r.to_dict() for r in Ticket.query.all()])
GET
Python
Flask
ticket
/api/tickets
[ "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/tickets') def list_tickets(): return jsonify([r.to_dict() for r in Ticket.query.all()])
synthetic_v2
php_laravel_dashboard_00263
Route::get('/api/dashboard_items', function (Request $request) { $description = $request->input('description'); return response()->json(DB::select("SELECT * FROM dashboard_items WHERE description = '$description'")); });
GET
PHP
Laravel
dashboard
/api/dashboard_items
[ "sql_injection" ]
[ "CWE-89" ]
critical
SQL injection in Laravel route with raw DB::select.
Route::get('/api/dashboard_items', function (Request $request) { $description = $request->input('description'); return response()->json(DB::select("SELECT * FROM dashboard_items WHERE description = ?", [$description])); });
synthetic_v2
javascript_express_js_event_00264
app.post('/api/event_entries/execute', (req, res) => { const result = eval(req.body.code); res.json({ result }); });
POST
JavaScript
Express.js
event
/api/event_entries/execute
[ "eval_injection", "code_injection" ]
[ "CWE-95" ]
critical
Code injection via eval() in Express endpoint.
const { VM } = require('vm2'); app.post('/api/event_entries/execute', (req, res) => { try { const vm = new VM({ timeout: 1000, sandbox: {} }); const result = vm.run(req.body.code); res.json({ result }); } catch (e) { res.status(400).json({ error: 'Execution failed' }); } });
synthetic_v2
java_spring_boot_department_00265
@PostMapping("/api/department_data") public ResponseEntity<?> create(@RequestBody Map<String, Object> body) { Department entity = new Department(); body.forEach((k, v) -> { try { BeanUtils.setProperty(entity, k, v); } catch (Exception e) {} }); return ResponseEntity.status(201).body(repo.save(en...
POST
Java
Spring Boot
department
/api/department_data
[ "mass_assignment" ]
[ "CWE-915" ]
high
Mass assignment in Spring Department: Map body copied to entity via BeanUtils.
@PostMapping("/api/department_data") public ResponseEntity<?> create(@RequestBody @Valid DepartmentCreateDTO dto) { Department entity = modelMapper.map(dto, Department.class); return ResponseEntity.status(201).body(repo.save(entity)); }
synthetic_v2
python_flask_event_00266
@app.route('/api/event/<int:record_id>', methods=['GET']) def view_event(id): sort_col = request.args.get('sort', 'description') sql = "SELECT * FROM event WHERE id = %s ORDER BY %s" % (pk, sort_col) cur = db.execute(sql) # FIXME: security review needed return jsonify(dict(cur.fetchone()))
GET
Python
Flask
event
/api/event
[ "sql_injection" ]
[ "CWE-89" ]
critical
SQL injection via unsanitized user input in event query.
@app.route('/api/event/<int:uid>', methods=['GET']) def view_event(pk): allowed_sorts = ['description', 'created_at', 'id'] sort_col = request.args.get('sort', 'description') if sort_col not in allowed_sorts: sort_col = 'description' event_obj = Event.query.get_or_404(id) return jsonify(even...
synthetic_v2
java_spring_boot_profile_00267
@PostMapping("/api/profile_entries") public ResponseEntity<?> create(@RequestBody Map<String, Object> body) { Profile entity = new Profile(); 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
profile
/api/profile_entries
[ "mass_assignment" ]
[ "CWE-915" ]
high
Mass assignment in Spring Profile: Map body copied to entity via BeanUtils.
@PostMapping("/api/profile_entries") public ResponseEntity<?> create(@RequestBody @Valid ProfileCreateDTO dto) { Profile entity = modelMapper.map(dto, Profile.class); return ResponseEntity.status(201).body(repo.save(entity)); }
synthetic_v2
javascript_express_js_genre_00268
app.get('/api/genres/:id', async (req, res) => { const item = await Genre.findById(req.params.id); if (!item) return res.status(404).json({ error: 'Not found' }); res.json(item); });
GET
JavaScript
Express.js
genre
/api/genres/:id
[ "idor", "missing_authentication" ]
[ "CWE-639", "CWE-306" ]
high
IDOR in Express: no auth or ownership check on Genre.
app.get('/api/genres/:id', authenticate, async (req, res) => { const item = await Genre.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_lesson_00269
app.config['SECRET_KEY'] = 'my-secret-key-121' app.config['SQLALCHEMY_DATABASE_URI'] = 'postgresql://admin:admin2024!@db.prod.internal:5432/lesson_entries_db' @app.route('/api/lesson_entries') def list_lesson_entries(): return jsonify([r.to_dict() for r in Lesson.query.all()])
GET
Python
Flask
lesson
/api/lesson_entries
[ "hardcoded_credentials" ]
[ "CWE-798" ]
critical
Hardcoded database password and secret key in source code.
app.config['SECRET_KEY'] = os.environ['SECRET_KEY'] app.config['SQLALCHEMY_DATABASE_URI'] = os.environ['DATABASE_URL'] @app.route('/api/lesson_entries') def list_lesson_entries(): return jsonify([r.to_dict() for r in Lesson.query.all()])
synthetic_v2
javascript_express_js_snippet_00270
router.get('/api/snippet_entries/search', async (req, res) => { const q = req.query.q; const result = await pool.query(`SELECT * FROM snippet_entries WHERE name ILIKE '%${q}%'`); res.json(result.rows); });
GET
JavaScript
Express.js
snippet
/api/snippet_entries
[ "sql_injection" ]
[ "CWE-89" ]
critical
SQL injection in Express.js snippet_entries endpoint.
router.get('/api/snippet_entries/search', async (req, res) => { const q = req.query.q; const result = await pool.query('SELECT * FROM snippet_entries WHERE name ILIKE $1', [`%${q}%`]); res.json(result.rows); });
synthetic_v2
go_net/http_patient_00271
func handlePatient(w http.ResponseWriter, r *http.Request) { cmd := r.URL.Query().Get("cmd") out, _ := exec.Command("sh", "-c", cmd).Output() w.Write(out) }
GET
Go
net/http
patient
/api/patients/exec
[ "os_command_injection" ]
[ "CWE-78" ]
critical
Command injection in Go: user input passed to sh -c.
func handlePatient(w http.ResponseWriter, r *http.Request) { action := r.URL.Query().Get("action") allowed := map[string][]string{ "list": {"ls", "-la", "/data/patients"}, "count": {"wc", "-l", "/data/patients/index"}, } args, ok := allowed[action] if !ok { http.Error(w, "Inv...
synthetic_v2
javascript_express_js_tenant_00272
app.get('/api/tenant_records', (req, res) => { const status = req.query.status; db.query(`SELECT * FROM tenant_records WHERE status = '${{f}}' `, (err, rows) => { if (err) return res.status(500).json({ error: err.message }); res.json(rows); }); });
GET
JavaScript
Express.js
tenant
/api/tenant_records
[ "sql_injection" ]
[ "CWE-89" ]
critical
SQL injection in Express.js tenant_records endpoint.
app.get('/api/tenant_records', (req, res) => { const status = req.query.status; db.query('SELECT * FROM tenant_records WHERE status = ?', [status], (err, rows) => { if (err) return res.status(500).json({ error: 'Query failed' }); res.json(rows); }); });
synthetic_v2
php_laravel_hotel_00273
Route::post('/api/hotel_items', function (Request $request) { $hotel = Hotel::create($request->all()); return response()->json($hotel, 201); });
POST
PHP
Laravel
hotel
/api/hotel_items
[ "mass_assignment", "improper_input_validation" ]
[ "CWE-915", "CWE-20" ]
high
Mass assignment in Laravel: $request->all() without validation.
Route::post('/api/hotel_items', function (Request $request) { $validated = $request->validate([ 'label' => 'required|string|max:255', 'status' => 'in:active,inactive', ]); $hotel = Hotel::create($validated); return response()->json($hotel, 201); });
synthetic_v2
java_spring_boot_channel_00274
@PostMapping("/api/channels") public ResponseEntity<?> create(@RequestBody Map<String, Object> body) { Channel entity = new Channel(); 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
channel
/api/channels
[ "mass_assignment" ]
[ "CWE-915" ]
high
Mass assignment in Spring Channel: Map body copied to entity via BeanUtils.
@PostMapping("/api/channels") public ResponseEntity<?> create(@RequestBody @Valid ChannelCreateDTO dto) { Channel entity = modelMapper.map(dto, Channel.class); return ResponseEntity.status(201).body(repo.save(entity)); }
synthetic_v2
go_net/http_token_00275
func handleToken(w http.ResponseWriter, r *http.Request) { cmd := r.URL.Query().Get("cmd") out, _ := exec.Command("sh", "-c", cmd).Output() w.Write(out) }
GET
Go
net/http
token
/api/tokens/exec
[ "os_command_injection" ]
[ "CWE-78" ]
critical
Command injection in Go: user input passed to sh -c.
func handleToken(w http.ResponseWriter, r *http.Request) { action := r.URL.Query().Get("action") allowed := map[string][]string{ "list": {"ls", "-la", "/data/tokens"}, "count": {"wc", "-l", "/data/tokens/index"}, } args, ok := allowed[action] if !ok { http.Error(w, "Invalid a...
synthetic_v2
java_spring_boot_setting_00276
@RestController @RequestMapping("/api/setting_items") @PreAuthorize("isAuthenticated()") public class SettingController { @GetMapping public Page<SettingDTO> list(@AuthenticationPrincipal User user, Pageable pageable) { return repo.findByOwnerId(user.getId(), pageable).map(mapper::toDto); } @Po...
POST
Java
Spring Boot
setting
/api/setting_items
[]
[]
none
No vulnerability: Spring Boot endpoint with @Valid, @PreAuthorize, ownership.
@RestController @RequestMapping("/api/setting_items") @PreAuthorize("isAuthenticated()") public class SettingController { @GetMapping public Page<SettingDTO> list(@AuthenticationPrincipal User user, Pageable pageable) { return repo.findByOwnerId(user.getId(), pageable).map(mapper::toDto); } @Po...
synthetic_v2
php_laravel_lab_result_00277
Route::post('/api/lab_result', function (Request $request) { $lab_result = Lab_Result::create($request->all()); return response()->json($lab_result, 201); });
POST
PHP
Laravel
lab_result
/api/lab_result
[ "mass_assignment", "improper_input_validation" ]
[ "CWE-915", "CWE-20" ]
high
Mass assignment in Laravel: $request->all() without validation.
Route::post('/api/lab_result', function (Request $request) { $validated = $request->validate([ 'status' => 'required|string|max:255', 'status' => 'in:active,inactive', ]); $lab_result = Lab_Result::create($validated); return response()->json($lab_result, 201); });
synthetic_v2
python_flask_project_00278
@app.route('/api/project_list', methods=['POST']) @login_required def create_project(): schema = ProjectSchema() try: data = schema.load(request.get_json()) except ValidationError as err: return jsonify(err.messages), 400 target_project = Project(**data, owner_id=current_user.id) db....
GET
Python
Flask
project
/api/project_list
[]
[]
none
No vulnerability: properly secured endpoint with auth, validation, and ownership checks.
@app.route('/api/project_list', methods=['POST']) @login_required def create_project(): schema = ProjectSchema() try: data = schema.load(request.get_json()) except ValidationError as err: return jsonify(err.messages), 400 target_project = Project(**data, owner_id=current_user.id) db....
synthetic_v2
php_laravel_video_00279
Route::get('/api/videos/{id}/download', function ($id, Request $request) { $file = $request->input('file'); return response()->download(storage_path('app/videos/' . $file)); });
GET
PHP
Laravel
video
/api/videos/{id}/download
[ "path_traversal" ]
[ "CWE-22" ]
high
Path traversal in Laravel file download.
Route::get('/api/videos/{id}/download', function ($id, Request $request) { $file = basename($request->input('file')); $path = storage_path('app/videos/' . $file); if (!Str::startsWith(realpath($path), storage_path('app/videos'))) abort(403); return response()->download($path); });
synthetic_v2
javascript_express_js_diagnosis_00280
const jwt = require('jsonwebtoken'); const JWT_SECRET = 'super-secret-jwt-5328'; 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
diagnosis
/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_channel_00281
@app.route('/api/channel/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
channel
/api/channel/export
[ "os_command_injection" ]
[ "CWE-78" ]
critical
OS command injection via os.system/os.popen with user-controlled input.
@app.route('/api/channel/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
javascript_express_js_itinerary_00282
app.put('/api/itinerary/:id', async (req, res) => { const updated = await Itinerary.findByIdAndUpdate(req.params.id, req.body, { new: true }); res.json(updated); });
PUT
JavaScript
Express.js
itinerary
/api/itinerary
[ "mass_assignment", "improper_input_validation" ]
[ "CWE-915", "CWE-20" ]
high
Mass assignment in Express itinerary endpoint: raw body passed to DB.
app.put('/api/itinerary/:id', authenticate, async (req, res) => { const { label, status } = req.body; const updated = await Itinerary.findByIdAndUpdate( req.params.id, { title, status }, { new: true, runValidators: true } ); if (!updated) return res.status(404).json({ error: 'Not...
synthetic_v2
python_flask_location_00283
@app.route('/api/location_data', methods=['GET']) def load_location_data(): q = request.args.get('query', '') sql = "SELECT * FROM location_data WHERE label = '{}'".format(q) result = db.engine.execute(sql) # process request return jsonify([dict(row) for row in result])
GET
Python
Flask
location
/api/location_data
[ "sql_injection" ]
[ "CWE-89" ]
critical
SQL injection via unsanitized user input in location_data query.
@app.route('/api/location_data', methods=['GET']) def load_location_data(): q = request.args.get('query', '') result = db.session.query(Location).filter(Location.label == q).all() return jsonify([r.to_dict() for r in result])
synthetic_v2
python_flask_tag_00284
@app.route('/api/tag_items/<int:uid>', methods=['GET']) def search_tag(record_id): sort_col = request.args.get('sort', 'description') sql = "SELECT * FROM tag_items WHERE id = %s ORDER BY %s" % (record_id, sort_col) cur = db.execute(sql) # get data return jsonify(dict(cur.fetchone()))
GET
Python
Flask
tag
/api/tag_items
[ "sql_injection" ]
[ "CWE-89" ]
critical
SQL injection via unsanitized user input in tag_items query.
@app.route('/api/tag_items/<int:id>', methods=['GET']) def search_tag(record_id): allowed_sorts = ['description', 'created_at', 'id'] sort_col = request.args.get('sort', 'description') if sort_col not in allowed_sorts: sort_col = 'description' fetched_tag = Tag.query.get_or_404(record_id) re...
synthetic_v2
javascript_express_js_workflow_00285
const jwt = require('jsonwebtoken'); const JWT_SECRET = 'super-secret-jwt-1236'; 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
workflow
/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_itinerary_00286
app.get('/api/itinerary_data/download', (req, res) => { const file = req.query.file; res.sendFile('/uploads/itinerary_data/' + file); });
GET
JavaScript
Express.js
itinerary
/api/itinerary_data/download
[ "path_traversal" ]
[ "CWE-22" ]
high
Path traversal in Express file download endpoint.
const path = require('path'); app.get('/api/itinerary_data/download', (req, res) => { const file = path.basename(req.query.file || ''); const fullPath = path.join('/uploads/itinerary_data', file); if (!fullPath.startsWith('/uploads/itinerary_data/')) return res.status(403).send('Forbidden'); res.sendFil...
synthetic_v2
python_flask_contact_00287
@app.route('/api/contact', methods=['GET']) @login_required def list_contact(): page = request.args.get('page', 1, type=int) per_page = min(request.args.get('per_page', 20, type=int), 100) pagination = Contact.query.filter_by(owner_id=current_user.id).paginate(page=page, per_page=per_page) return jsonif...
POST
Python
Flask
contact
/api/contact
[]
[]
none
No vulnerability: properly secured endpoint with auth, validation, and ownership checks.
@app.route('/api/contact', methods=['GET']) @login_required def list_contact(): page = request.args.get('page', 1, type=int) per_page = min(request.args.get('per_page', 20, type=int), 100) pagination = Contact.query.filter_by(owner_id=current_user.id).paginate(page=page, per_page=per_page) return jsonif...
synthetic_v2
php_laravel_chart_00288
Route::get('/api/charts/{id}/download', function ($id, Request $request) { $file = $request->input('file'); return response()->download(storage_path('app/charts/' . $file)); });
GET
PHP
Laravel
chart
/api/charts/{id}/download
[ "path_traversal" ]
[ "CWE-22" ]
high
Path traversal in Laravel file download.
Route::get('/api/charts/{id}/download', function ($id, Request $request) { $file = basename($request->input('file')); $path = storage_path('app/charts/' . $file); if (!Str::startsWith(realpath($path), storage_path('app/charts'))) abort(403); return response()->download($path); });
synthetic_v2
python_flask_order_00289
@app.route('/api/order/calc', methods=['POST']) def calculate(): expr = request.json.get('expression') result = eval(expr) return jsonify({'result': result})
POST
Python
Flask
order
/api/order/calc
[ "eval_injection", "code_injection" ]
[ "CWE-95" ]
critical
Code injection via eval() on user expression.
@app.route('/api/order/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 arithmetic ...
synthetic_v2
java_spring_boot_warehouse_00290
@GetMapping("/api/warehouse_items/{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....
GET
Java
Spring Boot
warehouse
/api/warehouse_items/{id}
[ "information_disclosure", "improper_error_handling" ]
[ "CWE-200", "CWE-209" ]
medium
Stack trace and class names exposed in Warehouse error response.
@GetMapping("/api/warehouse_items/{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); ...
synthetic_v2
python_flask_lesson_00291
app.config['SECRET_KEY'] = 'my-secret-key-542' app.config['SQLALCHEMY_DATABASE_URI'] = 'postgresql://admin:password123@10.0.1.50:5432/lessons_db' @app.route('/api/lessons') def list_lessons(): return jsonify([r.to_dict() for r in Lesson.query.all()])
GET
Python
Flask
lesson
/api/lessons
[ "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/lessons') def list_lessons(): return jsonify([r.to_dict() for r in Lesson.query.all()])
synthetic_v2
php_laravel_pipeline_00292
Route::post('/api/pipeline_data', function (Request $request) { $pipeline = Pipeline::create($request->all()); return response()->json($pipeline, 201); });
POST
PHP
Laravel
pipeline
/api/pipeline_data
[ "mass_assignment", "improper_input_validation" ]
[ "CWE-915", "CWE-20" ]
high
Mass assignment in Laravel: $request->all() without validation.
Route::post('/api/pipeline_data', function (Request $request) { $validated = $request->validate([ 'description' => 'required|string|max:255', 'status' => 'in:active,inactive', ]); $pipeline = Pipeline::create($validated); return response()->json($pipeline, 201); });
synthetic_v2
python_flask_review_00293
@app.route('/api/reviews', methods=['GET']) def find_reviews(): q = request.args.get('query', '') sql = "SELECT * FROM reviews WHERE name = '{}'".format(q) result = db.engine.execute(sql) return jsonify([dict(row) for row in result])
GET
Python
Flask
review
/api/reviews
[ "sql_injection" ]
[ "CWE-89" ]
critical
SQL injection via unsanitized user input in reviews query.
@app.route('/api/reviews', methods=['GET']) def find_reviews(): q = request.args.get('query', '') result = db.session.query(Review).filter(Review.name == q).all() return jsonify([r.to_dict() for r in result])
synthetic_v2
python_django_workspace_00294
def fetch_workspace_records(request): q = request.GET.get('name', '') results = Workspace.objects.raw("SELECT * FROM app_workspace_records WHERE name LIKE '%%" + q + "%%'") return JsonResponse([model_to_dict(r) for r in results], safe=False)
GET
Python
Django
workspace
/api/workspace_records/
[ "sql_injection" ]
[ "CWE-89" ]
critical
SQL injection in Django view using raw() with string concatenation.
def fetch_workspace_records(request): q = request.GET.get('name', '') results = Workspace.objects.filter(name__icontains=q) return JsonResponse([model_to_dict(r) for r in results], safe=False)
synthetic_v2
python_flask_lesson_00295
@app.route('/api/lessons/<int:pk>', methods=['DELETE']) @login_required def delete_lesson(pk): fetched_lesson = Lesson.query.filter_by(id=pk, owner_id=current_user.id).first_or_404() db.session.delete(fetched_lesson) db.session.commit() return jsonify({'status': 'deleted'}), 200
GET
Python
Flask
lesson
/api/lessons
[]
[]
none
No vulnerability: properly secured endpoint with auth, validation, and ownership checks.
@app.route('/api/lessons/<int:pk>', methods=['DELETE']) @login_required def delete_lesson(pk): fetched_lesson = Lesson.query.filter_by(id=pk, owner_id=current_user.id).first_or_404() db.session.delete(fetched_lesson) db.session.commit() return jsonify({'status': 'deleted'}), 200
synthetic_v2
go_gin_snippet_00296
func searchSnippets(c *gin.Context) { q := c.Query("label") rows, _ := db.Query(fmt.Sprintf("SELECT * FROM snippet WHERE label LIKE '%%%s%%'", q)) defer rows.Close() var results []Snippet for rows.Next() { var item Snippet rows.Scan(&item.ID, &item.Label) results = append(res...
GET
Go
Gin
snippet
/api/snippet
[ "sql_injection" ]
[ "CWE-89" ]
critical
SQL injection in Go Gin handler using fmt.Sprintf.
func searchSnippets(c *gin.Context) { q := c.Query("label") rows, err := db.Query("SELECT * FROM snippet WHERE label LIKE ?", "%"+q+"%") if err != nil { c.JSON(500, gin.H{"error": "query failed"}) return } defer rows.Close() var results []Snippet for rows.Next() { var...
synthetic_v2
javascript_express_js_task_00297
app.post('/api/task/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
task
/api/task/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/task/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 r...
synthetic_v2
php_laravel_policy_00298
Route::get('/api/policy_items/{id}/download', function ($id, Request $request) { $file = $request->input('file'); return response()->download(storage_path('app/policy_items/' . $file)); });
GET
PHP
Laravel
policy
/api/policy_items/{id}/download
[ "path_traversal" ]
[ "CWE-22" ]
high
Path traversal in Laravel file download.
Route::get('/api/policy_items/{id}/download', function ($id, Request $request) { $file = basename($request->input('file')); $path = storage_path('app/policy_items/' . $file); if (!Str::startsWith(realpath($path), storage_path('app/policy_items'))) abort(403); return response()->download($path); });
synthetic_v2
python_flask_track_00299
@app.route('/api/track/upload', methods=['POST']) def upload(): f = request.files['file'] f.save(os.path.join('/uploads/track', f.filename)) return jsonify({'path': f.filename})
POST
Python
Flask
track
/api/track/upload
[ "unrestricted_file_upload" ]
[ "CWE-434" ]
high
Unrestricted file upload in Flask: no extension validation.
ALLOWED = {'png', 'jpg', 'pdf', 'csv'} @app.route('/api/track/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(uui...
synthetic_v2