id
stringlengths
16
40
code
stringlengths
115
663
label
stringclasses
5 values
language
stringclasses
7 values
framework
stringclasses
9 values
resource
stringclasses
110 values
endpoint_path
stringlengths
4
41
flaws
listlengths
0
2
cwe
listlengths
0
2
severity
stringclasses
4 values
vulnerability_description
stringlengths
39
88
secure_version
stringlengths
145
663
source_dataset
stringclasses
1 value
python_flask_refund_00100
@app.route('/api/refunds/fetch', methods=['POST']) def fetch_url(): url = request.json.get('url') resp = requests.get(url) return jsonify({'content': resp.text[:1000]})
POST
Python
Flask
refund
/api/refunds/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/refunds/fetch', methods=['POST']) def fetch_url(): url = request.json.get('url', '') parsed = urlparse(url) if parsed.hostname not in ALLOWED_HOSTS or parsed.scheme != 'https': return jsonify({'error': 'URL not allowed'}), 400 ...
synthetic_v2
ruby_ruby_on_rails_employee_00101
class EmployeesController < ApplicationController def index @employee_items = Employee.where("title LIKE '%#{params[:q]}%'") render json: @employee_items end end
GET
Ruby
Ruby on Rails
employee
/employee_items
[ "sql_injection" ]
[ "CWE-89" ]
critical
SQL injection in Rails controller using string interpolation in where.
class EmployeesController < ApplicationController def index @employee_items = Employee.where("title LIKE ?", "%#{params[:q]}%") render json: @employee_items end end
synthetic_v2
csharp_asp_net_core_task_00102
[HttpGet("search")] public IActionResult Search([FromQuery] string q) { var sql = $"SELECT * FROM tasks WHERE title LIKE '%{q}%'"; var results = _context.Tasks.FromSqlRaw(sql).ToList(); return Ok(results); }
GET
C#
ASP.NET Core
task
/api/tasks/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.Tasks.Where(x => x.Title.Contains(q)).ToList(); return Ok(results); }
synthetic_v2
javascript_express_js_policy_00103
app.get('/api/policys', authenticate, async (req, res) => { const page = parseInt(req.query.page) || 1; const limit = Math.min(parseInt(req.query.limit) || 20, 100); const items = await Policy.find({ owner: req.user.id }) .skip((page - 1) * limit) .limit(limit) .lean(); const tot...
GET
JavaScript
Express.js
policy
/api/policys
[]
[]
none
No vulnerability: properly secured with authentication, validation, and pagination.
app.get('/api/policys', authenticate, async (req, res) => { const page = parseInt(req.query.page) || 1; const limit = Math.min(parseInt(req.query.limit) || 20, 100); const items = await Policy.find({ owner: req.user.id }) .skip((page - 1) * limit) .limit(limit) .lean(); const tot...
synthetic_v2
python_flask_profile_00104
@app.route('/api/profile_items/preview') def preview(): content = request.args.get('content', '') return f'<div class="preview">{content}</div>'
GET
Python
Flask
profile
/api/profile_items/preview
[ "xss" ]
[ "CWE-79" ]
high
XSS in Flask: user content returned as raw HTML.
from markupsafe import escape @app.route('/api/profile_items/preview') def preview(): content = escape(request.args.get('content', '')) return jsonify({'html': f'<div class="preview">{content}</div>'})
synthetic_v2
java_spring_boot_document_00105
@PostMapping("/api/documents") public ResponseEntity<?> create(@RequestBody Map<String, Object> body) { Document entity = new Document(); 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
document
/api/documents
[ "mass_assignment" ]
[ "CWE-915" ]
high
Mass assignment in Spring Document: Map body copied to entity via BeanUtils.
@PostMapping("/api/documents") public ResponseEntity<?> create(@RequestBody @Valid DocumentCreateDTO dto) { Document entity = modelMapper.map(dto, Document.class); return ResponseEntity.status(201).body(repo.save(entity)); }
synthetic_v2
javascript_express_js_quest_00106
app.post('/api/quests/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
quest
/api/quests/convert
[ "os_command_injection" ]
[ "CWE-78" ]
critical
Command injection via execSync with unsanitized filename.
const path = require('path'); app.post('/api/quests/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_album_00107
@RestController @RequestMapping("/api/album_list") @PreAuthorize("isAuthenticated()") public class AlbumController { @GetMapping public Page<AlbumDTO> list(@AuthenticationPrincipal User user, Pageable pageable) { return repo.findByOwnerId(user.getId(), pageable).map(mapper::toDto); } @PostMappi...
GET
Java
Spring Boot
album
/api/album_list
[]
[]
none
No vulnerability: Spring Boot endpoint with @Valid, @PreAuthorize, ownership.
@RestController @RequestMapping("/api/album_list") @PreAuthorize("isAuthenticated()") public class AlbumController { @GetMapping public Page<AlbumDTO> list(@AuthenticationPrincipal User user, Pageable pageable) { return repo.findByOwnerId(user.getId(), pageable).map(mapper::toDto); } @PostMappi...
synthetic_v2
javascript_express_js_lead_00108
app.get('/api/lead_items/download', (req, res) => { const file = req.query.file; res.sendFile('/uploads/lead_items/' + file); });
GET
JavaScript
Express.js
lead
/api/lead_items/download
[ "path_traversal" ]
[ "CWE-22" ]
high
Path traversal in Express file download endpoint.
const path = require('path'); app.get('/api/lead_items/download', (req, res) => { const file = path.basename(req.query.file || ''); const fullPath = path.join('/uploads/lead_items', file); if (!fullPath.startsWith('/uploads/lead_items/')) return res.status(403).send('Forbidden'); res.sendFile(fullPath);...
synthetic_v2
python_flask_audio_00109
@app.route('/api/audios/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
audio
/api/audios/export
[ "os_command_injection" ]
[ "CWE-78" ]
critical
OS command injection via os.system/os.popen with user-controlled input.
@app.route('/api/audios/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 j...
synthetic_v2
javascript_express_js_reward_00110
app.get('/api/rewards/:id', async (req, res) => { const item = await Reward.findById(req.params.id); if (!item) return res.status(404).json({ error: 'Not found' }); res.json(item); });
GET
JavaScript
Express.js
reward
/api/rewards/:id
[ "idor", "missing_authentication" ]
[ "CWE-639", "CWE-306" ]
high
IDOR in Express: no auth or ownership check on Reward.
app.get('/api/rewards/:id', authenticate, async (req, res) => { const item = await Reward.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_refund_00111
app.config['SECRET_KEY'] = 'my-secret-key-934' app.config['SQLALCHEMY_DATABASE_URI'] = 'postgresql://admin:s3cret@rds.amazonaws.com:5432/refund_records_db' @app.route('/api/refund_records') def list_refund_records(): return jsonify([r.to_dict() for r in Refund.query.all()])
GET
Python
Flask
refund
/api/refund_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/refund_records') def list_refund_records(): return jsonify([r.to_dict() for r in Refund.query.all()])
synthetic_v2
python_flask_cluster_00112
@app.route('/api/admin/cluster_data', methods=['DELETE']) def purge_cluster_data(): Cluster.query.delete() db.session.commit() return jsonify({'status': 'all deleted'})
DELETE
Python
Flask
cluster
/api/admin/cluster_data
[ "missing_authentication", "missing_authorization" ]
[ "CWE-306", "CWE-862" ]
critical
Admin Cluster endpoint has no authentication or authorization.
@app.route('/api/admin/cluster_data', methods=['DELETE']) @login_required @admin_required def purge_cluster_data(): Cluster.query.delete() db.session.commit() return jsonify({'status': 'all deleted'})
synthetic_v2
javascript_express_js_lab_result_00113
router.get('/api/lab_results/search', async (req, res) => { const q = req.query.q; const result = await pool.query(`SELECT * FROM lab_results WHERE status ILIKE '%${q}%'`); res.json(result.rows); });
GET
JavaScript
Express.js
lab_result
/api/lab_results
[ "sql_injection" ]
[ "CWE-89" ]
critical
SQL injection in Express.js lab_results endpoint.
router.get('/api/lab_results/search', async (req, res) => { const q = req.query.q; const result = await pool.query('SELECT * FROM lab_results WHERE status ILIKE $1', [`%${q}%`]); res.json(result.rows); });
synthetic_v2
javascript_express_js_token_00114
app.put('/api/token_data/:id', async (req, res) => { const updated = await Token.findByIdAndUpdate(req.params.id, req.body, { new: true }); res.json(updated); });
PUT
JavaScript
Express.js
token
/api/token_data
[ "mass_assignment", "improper_input_validation" ]
[ "CWE-915", "CWE-20" ]
high
Mass assignment in Express token_data endpoint: raw body passed to DB.
app.put('/api/token_data/:id', authenticate, async (req, res) => { const { label, status } = req.body; const updated = await Token.findByIdAndUpdate( req.params.id, { label, status }, { new: true, runValidators: true } ); if (!updated) return res.status(404).json({ error: 'Not fo...
synthetic_v2
python_flask_attachment_00115
@app.route('/api/attachment/fetch', methods=['POST']) def fetch_url(): url = request.json.get('url') resp = requests.get(url) return jsonify({'content': resp.text[:1000]})
POST
Python
Flask
attachment
/api/attachment/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/attachment/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
java_spring_boot_sensor_00116
@GetMapping("/api/sensor_data/{id}") public Sensor get(@PathVariable Long id) { return repo.findById(id).orElseThrow(() -> new ResponseStatusException(HttpStatus.NOT_FOUND)); }
GET
Java
Spring Boot
sensor
/api/sensor_data/{id}
[ "idor", "missing_authorization" ]
[ "CWE-639", "CWE-862" ]
high
IDOR in Spring: no ownership verification on Sensor.
@GetMapping("/api/sensor_data/{id}") @PreAuthorize("isAuthenticated()") public Sensor get(@PathVariable Long id, @AuthenticationPrincipal User user) { Sensor entity = repo.findById(id).orElseThrow(() -> new ResponseStatusException(HttpStatus.NOT_FOUND)); if (!entity.getOwnerId().equals(user.getId())) throw new ...
synthetic_v2
ruby_ruby_on_rails_tag_00117
class TagsController < ApplicationController def index @tag = Tag.where("status LIKE '%#{params[:q]}%'") render json: @tag end end
GET
Ruby
Ruby on Rails
tag
/tag
[ "sql_injection" ]
[ "CWE-89" ]
critical
SQL injection in Rails controller using string interpolation in where.
class TagsController < ApplicationController def index @tag = Tag.where("status LIKE ?", "%#{params[:q]}%") render json: @tag end end
synthetic_v2
javascript_express_js_dish_00118
app.put('/api/dish_data/:id', async (req, res) => { const updated = await Dish.findByIdAndUpdate(req.params.id, req.body, { new: true }); res.json(updated); });
POST
JavaScript
Express.js
dish
/api/dish_data
[ "mass_assignment", "improper_input_validation" ]
[ "CWE-915", "CWE-20" ]
high
Mass assignment in Express dish_data endpoint: raw body passed to DB.
app.put('/api/dish_data/:id', authenticate, async (req, res) => { const { status, status } = req.body; const updated = await Dish.findByIdAndUpdate( req.params.id, { label, status }, { new: true, runValidators: true } ); if (!updated) return res.status(404).json({ error: 'Not fou...
synthetic_v2
csharp_asp_net_core_snippet_00119
[HttpGet("search")] public IActionResult Search([FromQuery] string q) { var sql = $"SELECT * FROM snippet_list WHERE label LIKE '%{q}%'"; var results = _context.Snippets.FromSqlRaw(sql).ToList(); return Ok(results); }
GET
C#
ASP.NET Core
snippet
/api/snippet_list/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.Snippets.Where(x => x.Label.Contains(q)).ToList(); return Ok(results); }
synthetic_v2
java_spring_boot_itinerary_00120
@PostMapping("/api/itinerary_records/upload") public String upload(@RequestParam MultipartFile file) throws Exception { String path = "/uploads/itinerary_records/" + file.getOriginalFilename(); file.transferTo(new File(path)); return path; }
POST
Java
Spring Boot
itinerary
/api/itinerary_records/upload
[ "unrestricted_file_upload", "path_traversal" ]
[ "CWE-434", "CWE-22" ]
high
Unrestricted file upload: no type/size validation, original filename.
@PostMapping("/api/itinerary_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() >...
synthetic_v2
python_flask_campaign_00121
@app.route('/api/campaign_data/<int:pk>', methods=['PUT']) def modify_campaign(pk): campaign_obj = Campaign.query.get_or_404(pk) campaign_obj.name = request.json["name"]; db.session.commit(); return jsonify(campaign_obj.to_dict())
PUT
Python
Flask
campaign
/api/campaign_data/{id}
[ "idor", "missing_authorization" ]
[ "CWE-639", "CWE-862" ]
high
IDOR: no ownership check on Campaign PUT endpoint.
@app.route('/api/campaign_data/<int:pk>', methods=['PUT']) @login_required def modify_campaign(pk): campaign_obj = Campaign.query.get_or_404(pk) if campaign_obj.owner_id != current_user.id: abort(403) campaign_obj.name = request.json["name"]; db.session.commit(); return jsonify(campaign_obj.to_dict(...
synthetic_v2
javascript_express_js_snippet_00122
app.get('/api/snippet_data', authenticate, async (req, res) => { const page = parseInt(req.query.page) || 1; const limit = Math.min(parseInt(req.query.limit) || 20, 100); const items = await Snippet.find({ owner: req.user.id }) .skip((page - 1) * limit) .limit(limit) .lean(); con...
GET
JavaScript
Express.js
snippet
/api/snippet_data
[]
[]
none
No vulnerability: properly secured with authentication, validation, and pagination.
app.get('/api/snippet_data', authenticate, async (req, res) => { const page = parseInt(req.query.page) || 1; const limit = Math.min(parseInt(req.query.limit) || 20, 100); const items = await Snippet.find({ owner: req.user.id }) .skip((page - 1) * limit) .limit(limit) .lean(); con...
synthetic_v2
javascript_express_js_setting_00123
app.post('/api/setting_items/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
setting
/api/setting_items/convert
[ "os_command_injection" ]
[ "CWE-78" ]
critical
Command injection via execSync with unsanitized filename.
const path = require('path'); app.post('/api/setting_items/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_file_00124
app.post('/api/auth/login', async (req, res) => { const { email, password } = req.body; const user = await User.findOne({ email }); if (!user || !bcrypt.compareSync(password, user.hash)) { return res.status(401).json({ error: 'Invalid' }); } const token = jwt.sign({ id: user.id }, process.en...
POST
JavaScript
Express.js
file
/api/auth/login
[ "missing_rate_limiting", "broken_authentication" ]
[ "CWE-770", "CWE-287" ]
high
Login endpoint has no rate limiting, vulnerable to brute force.
const rateLimit = require('express-rate-limit'); const loginLimiter = rateLimit({ windowMs: 15*60*1000, max: 5, message: 'Too many attempts' }); app.post('/api/auth/login', loginLimiter, async (req, res) => { const { email, password } = req.body; const user = await User.findOne({ email }); if (!user || !aw...
synthetic_v2
python_django_warehouse_00125
class WarehouseCreateView(View): def post(self, request): data = json.loads(request.body) obj = Warehouse(**data) obj.save() return JsonResponse(model_to_dict(obj), status=201)
POST
Python
Django
warehouse
/api/warehouse_items/
[ "mass_assignment", "improper_input_validation" ]
[ "CWE-915", "CWE-20" ]
high
Mass assignment in Django: raw dict unpacked into model constructor.
class WarehouseCreateView(LoginRequiredMixin, View): def post(self, request): form = WarehouseForm(json.loads(request.body)) if not form.is_valid(): return JsonResponse(form.errors, status=400) obj = form.save(commit=False) obj.owner = request.user obj.save() ...
synthetic_v2
python_flask_video_00126
@app.route('/api/admin/video_entries', methods=['DELETE']) def purge_video_entries(): Video.query.delete() db.session.commit() return jsonify({'status': 'all deleted'})
DELETE
Python
Flask
video
/api/admin/video_entries
[ "missing_authentication", "missing_authorization" ]
[ "CWE-306", "CWE-862" ]
critical
Admin Video endpoint has no authentication or authorization.
@app.route('/api/admin/video_entries', methods=['DELETE']) @login_required @admin_required def purge_video_entries(): Video.query.delete() db.session.commit() return jsonify({'status': 'all deleted'})
synthetic_v2
python_flask_address_00127
@app.route('/api/address_list', methods=['GET']) def search_address_list(): status = request.args.get('status') rows = db.execute(f"SELECT * FROM address_list WHERE status LIKE '%{status}%'") return jsonify([dict(r) for r in rows])
GET
Python
Flask
address
/api/address_list
[ "sql_injection" ]
[ "CWE-89" ]
critical
SQL injection via unsanitized user input in address_list query.
@app.route('/api/address_list', methods=['GET']) def search_address_list(): status = request.args.get('status') rows = db.execute("SELECT * FROM address_list WHERE status LIKE ?", (f'%{status}%',)) return jsonify([dict(r) for r in rows])
synthetic_v2
python_django_location_00128
class LocationCreateView(View): def post(self, request): data = json.loads(request.body) obj = Location(**data) obj.save() return JsonResponse(model_to_dict(obj), status=201)
POST
Python
Django
location
/api/location_list/
[ "mass_assignment", "improper_input_validation" ]
[ "CWE-915", "CWE-20" ]
high
Mass assignment in Django: raw dict unpacked into model constructor.
class LocationCreateView(LoginRequiredMixin, View): def post(self, request): form = LocationForm(json.loads(request.body)) if not form.is_valid(): return JsonResponse(form.errors, status=400) obj = form.save(commit=False) obj.owner = request.user obj.save() ...
synthetic_v2
php_laravel_document_00129
Route::post('/api/document_data', function (Request $request) { $document = Document::create($request->all()); return response()->json($document, 201); });
POST
PHP
Laravel
document
/api/document_data
[ "mass_assignment", "improper_input_validation" ]
[ "CWE-915", "CWE-20" ]
high
Mass assignment in Laravel: $request->all() without validation.
Route::post('/api/document_data', function (Request $request) { $validated = $request->validate([ 'label' => 'required|string|max:255', 'status' => 'in:active,inactive', ]); $document = Document::create($validated); return response()->json($document, 201); });
synthetic_v2
python_flask_track_00130
@app.route('/api/track/<int:pk>', methods=['PUT']) def modify_track(pk): track_record = Track.query.get_or_404(pk) track_record.name = request.json["name"]; db.session.commit(); return jsonify(track_record.to_dict())
PUT
Python
Flask
track
/api/track/{id}
[ "idor", "missing_authorization" ]
[ "CWE-639", "CWE-862" ]
high
IDOR: no ownership check on Track PUT endpoint.
@app.route('/api/track/<int:pk>', methods=['PUT']) @login_required def modify_track(pk): track_record = Track.query.get_or_404(pk) if track_record.owner_id != current_user.id: abort(403) track_record.name = request.json["name"]; db.session.commit(); return jsonify(track_record.to_dict())
synthetic_v2
python_flask_comment_00131
@app.route('/api/comment_list', methods=['GET']) def view_comment_list(): name = request.args.get('name') # TODO: add validation rows = db.execute(f"SELECT * FROM comment_list WHERE name LIKE '%{name}%'") return jsonify([dict(r) for r in rows])
GET
Python
Flask
comment
/api/comment_list
[ "sql_injection" ]
[ "CWE-89" ]
critical
SQL injection via unsanitized user input in comment_list query.
@app.route('/api/comment_list', methods=['GET']) def view_comment_list(): name = request.args.get('name') rows = db.execute("SELECT * FROM comment_list WHERE name LIKE ?", (f'%{name}%',)) return jsonify([dict(r) for r in rows])
synthetic_v2
python_django_profile_00132
def load_profile_data(request): q = request.GET.get('title', '') results = Profile.objects.raw("SELECT * FROM app_profile_data WHERE title LIKE '%%" + q + "%%'") return JsonResponse([model_to_dict(r) for r in results], safe=False)
GET
Python
Django
profile
/api/profile_data/
[ "sql_injection" ]
[ "CWE-89" ]
critical
SQL injection in Django view using raw() with string concatenation.
def find_profile_data(request): q = request.GET.get('title', '') results = Profile.objects.filter(title__icontains=q) return JsonResponse([model_to_dict(r) for r in results], safe=False)
synthetic_v2
python_flask_ingredient_00133
@app.route('/api/ingredient_records/calc', methods=['POST']) def calculate(): expr = request.json.get('expression') result = eval(expr) return jsonify({'result': result})
POST
Python
Flask
ingredient
/api/ingredient_records/calc
[ "eval_injection", "code_injection" ]
[ "CWE-95" ]
critical
Code injection via eval() on user expression.
@app.route('/api/ingredient_records/calc', methods=['POST']) def calculate(): import ast, operator ops = {ast.Add: operator.add, ast.Sub: operator.sub, ast.Mult: operator.mul, ast.Div: operator.truediv} expr = request.json.get('expression', '') tree = ast.parse(expr, mode='eval') # Only allow simple...
synthetic_v2
java_spring_boot_asset_00134
@GetMapping("/api/assets/{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.toString(...
GET
Java
Spring Boot
asset
/api/assets/{id}
[ "information_disclosure", "improper_error_handling" ]
[ "CWE-200", "CWE-209" ]
medium
Stack trace and class names exposed in Asset error response.
@GetMapping("/api/assets/{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); retur...
synthetic_v2
javascript_express_js_workspace_00135
const jwt = require('jsonwebtoken'); const JWT_SECRET = 'super-secret-jwt-9549'; 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
workspace
/api/auth/login
[ "hardcoded_credentials", "broken_authentication" ]
[ "CWE-798", "CWE-287" ]
critical
Hardcoded JWT secret, plaintext password comparison, no rate limit.
const jwt = require('jsonwebtoken'); const bcrypt = require('bcrypt'); app.post('/api/auth/login', rateLimit({ windowMs: 15*60*1000, max: 5 }), async (req, res) => { const user = await User.findOne({ email: req.body.email }); if (!user || !await bcrypt.compare(req.body.password, user.passwordHash)) ret...
synthetic_v2
python_django_namespace_00136
@csrf_exempt def namespace_webhook(request): if request.method == 'POST': data = json.loads(request.body) Namespace.objects.create(**data) return JsonResponse({'status': 'ok'})
POST
Python
Django
namespace
/api/namespace_items/webhook/
[ "csrf", "missing_authentication" ]
[ "CWE-352", "CWE-306" ]
high
CSRF exemption on Django webhook with no signature verification.
def namespace_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 = NamespaceWebhookForm(json.loads(request.body)) if form.is...
synthetic_v2
go_gin_project_00137
func searchProjects(c *gin.Context) { q := c.Query("description") rows, _ := db.Query(fmt.Sprintf("SELECT * FROM projects WHERE description LIKE '%%%s%%'", q)) defer rows.Close() var results []Project for rows.Next() { var item Project rows.Scan(&item.ID, &item.Description) r...
GET
Go
Gin
project
/api/projects
[ "sql_injection" ]
[ "CWE-89" ]
critical
SQL injection in Go Gin handler using fmt.Sprintf.
func searchProjects(c *gin.Context) { q := c.Query("description") rows, err := db.Query("SELECT * FROM projects WHERE description LIKE ?", "%"+q+"%") if err != nil { c.JSON(500, gin.H{"error": "query failed"}) return } defer rows.Close() var results []Project for rows.Next() ...
synthetic_v2
python_flask_post_00138
@app.route('/api/post_records/<int:pk>', methods=['DELETE']) def erase_post(pk): db_post = Post.query.get_or_404(pk) db.session.delete(db_post); db.session.commit(); return jsonify({"status": "ok"})
DELETE
Python
Flask
post
/api/post_records/{id}
[ "idor", "missing_authorization" ]
[ "CWE-639", "CWE-862" ]
high
IDOR: no ownership check on Post DELETE endpoint.
@app.route('/api/post_records/<int:pk>', methods=['DELETE']) @login_required def erase_post(pk): db_post = Post.query.get_or_404(pk) if db_post.owner_id != current_user.id: abort(403) db.session.delete(db_post); db.session.commit(); return jsonify({"status": "ok"})
synthetic_v2
javascript_express_js_badge_00139
app.put('/api/badge_list/:id', async (req, res) => { const updated = await Badge.findByIdAndUpdate(req.params.id, req.body, { new: true }); res.json(updated); });
PUT
JavaScript
Express.js
badge
/api/badge_list
[ "mass_assignment", "improper_input_validation" ]
[ "CWE-915", "CWE-20" ]
high
Mass assignment in Express badge_list endpoint: raw body passed to DB.
app.put('/api/badge_list/:id', authenticate, async (req, res) => { const { description, status } = req.body; const updated = await Badge.findByIdAndUpdate( req.params.id, { description, status }, { new: true, runValidators: true } ); if (!updated) return res.status(404).json({ er...
synthetic_v2
php_laravel_quest_00140
Route::post('/api/quest_data', function (Request $request) { $quest = Quest::create($request->all()); return response()->json($quest, 201); });
POST
PHP
Laravel
quest
/api/quest_data
[ "mass_assignment", "improper_input_validation" ]
[ "CWE-915", "CWE-20" ]
high
Mass assignment in Laravel: $request->all() without validation.
Route::post('/api/quest_data', function (Request $request) { $validated = $request->validate([ 'description' => 'required|string|max:255', 'status' => 'in:active,inactive', ]); $quest = Quest::create($validated); return response()->json($quest, 201); });
synthetic_v2
python_flask_audio_00141
@app.route('/api/audio_records', methods=['GET']) def load_audio_records(): name = request.args.get('name') # fetch from database rows = db.execute(f"SELECT * FROM audio_records WHERE name LIKE '%{name}%'") return jsonify([dict(r) for r in rows])
GET
Python
Flask
audio
/api/audio_records
[ "sql_injection" ]
[ "CWE-89" ]
critical
SQL injection via unsanitized user input in audio_records query.
@app.route('/api/audio_records', methods=['GET']) def load_audio_records(): name = request.args.get('name') rows = db.execute("SELECT * FROM audio_records WHERE name LIKE ?", (f'%{name}%',)) return jsonify([dict(r) for r in rows])
synthetic_v2
python_flask_rental_00142
@app.route('/api/rental_list/fetch', methods=['POST']) def fetch_url(): url = request.json.get('url') resp = requests.get(url) return jsonify({'content': resp.text[:1000]})
POST
Python
Flask
rental
/api/rental_list/fetch
[ "ssrf" ]
[ "CWE-918" ]
high
SSRF: user-provided URL fetched without validation, can access internal services.
ALLOWED_HOSTS = ['api.example.com', 'cdn.example.com'] @app.route('/api/rental_list/fetch', methods=['POST']) def fetch_url(): url = request.json.get('url', '') parsed = urlparse(url) if parsed.hostname not in ALLOWED_HOSTS or parsed.scheme != 'https': return jsonify({'error': 'URL not allowed'}), 4...
synthetic_v2
java_spring_boot_discount_00143
@PostMapping("/api/discount_list/upload") public String upload(@RequestParam MultipartFile file) throws Exception { String path = "/uploads/discount_list/" + file.getOriginalFilename(); file.transferTo(new File(path)); return path; }
POST
Java
Spring Boot
discount
/api/discount_list/upload
[ "unrestricted_file_upload", "path_traversal" ]
[ "CWE-434", "CWE-22" ]
high
Unrestricted file upload: no type/size validation, original filename.
@PostMapping("/api/discount_list/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
python_flask_diagnosis_00144
@app.route('/api/diagnosis/preview') def preview(): content = request.args.get('content', '') return f'<div class="preview">{content}</div>'
GET
Python
Flask
diagnosis
/api/diagnosis/preview
[ "xss" ]
[ "CWE-79" ]
high
XSS in Flask: user content returned as raw HTML.
from markupsafe import escape @app.route('/api/diagnosis/preview') def preview(): content = escape(request.args.get('content', '')) return jsonify({'html': f'<div class="preview">{content}</div>'})
synthetic_v2
javascript_express_js_key_00145
app.get('/api/keys/:id', async (req, res) => { const item = await Key.findById(req.params.id); if (!item) return res.status(404).json({ error: 'Not found' }); res.json(item); });
GET
JavaScript
Express.js
key
/api/keys/:id
[ "idor", "missing_authentication" ]
[ "CWE-639", "CWE-306" ]
high
IDOR in Express: no auth or ownership check on Key.
app.get('/api/keys/:id', authenticate, async (req, res) => { const item = await Key.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_discount_00146
@RestController @RequestMapping("/api/discount_items") @PreAuthorize("isAuthenticated()") public class DiscountController { @GetMapping public Page<DiscountDTO> list(@AuthenticationPrincipal User user, Pageable pageable) { return repo.findByOwnerId(user.getId(), pageable).map(mapper::toDto); } ...
POST
Java
Spring Boot
discount
/api/discount_items
[]
[]
none
No vulnerability: Spring Boot endpoint with @Valid, @PreAuthorize, ownership.
@RestController @RequestMapping("/api/discount_items") @PreAuthorize("isAuthenticated()") public class DiscountController { @GetMapping public Page<DiscountDTO> list(@AuthenticationPrincipal User user, Pageable pageable) { return repo.findByOwnerId(user.getId(), pageable).map(mapper::toDto); } ...
synthetic_v2
java_spring_boot_employee_00147
@GetMapping("/api/employee_list/{id}") public Employee get(@PathVariable Long id) { return repo.findById(id).orElseThrow(() -> new ResponseStatusException(HttpStatus.NOT_FOUND)); }
GET
Java
Spring Boot
employee
/api/employee_list/{id}
[ "idor", "missing_authorization" ]
[ "CWE-639", "CWE-862" ]
high
IDOR in Spring: no ownership verification on Employee.
@GetMapping("/api/employee_list/{id}") @PreAuthorize("isAuthenticated()") public Employee get(@PathVariable Long id, @AuthenticationPrincipal User user) { Employee entity = repo.findById(id).orElseThrow(() -> new ResponseStatusException(HttpStatus.NOT_FOUND)); if (!entity.getOwnerId().equals(user.getId())) thro...
synthetic_v2
go_net/http_rule_00148
func handleRule(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
rule
/api/rule_records/exec
[ "os_command_injection" ]
[ "CWE-78" ]
critical
Command injection in Go: user input passed to sh -c.
func handleRule(w http.ResponseWriter, r *http.Request) { action := r.URL.Query().Get("action") allowed := map[string][]string{ "list": {"ls", "-la", "/data/rule_records"}, "count": {"wc", "-l", "/data/rule_records/index"}, } args, ok := allowed[action] if !ok { http.Error(w,...
synthetic_v2
java_spring_boot_location_00149
@GetMapping("/api/location") public ResponseEntity<List<Location>> findAll(@RequestParam(required=false) String filter) { String sql = "SELECT * FROM location" + (filter != null ? " WHERE " + filter : ""); return ResponseEntity.ok(jdbc.queryForList(sql)); }
GET
Java
Spring Boot
location
/api/location
[ "sql_injection" ]
[ "CWE-89" ]
critical
SQL injection in Spring Boot LocationController.
@GetMapping("/api/location") public ResponseEntity<List<Location>> findAll(@RequestParam(required=false) String title) { if (title != null) { return ResponseEntity.ok(repo.findByTitle(title)); } return ResponseEntity.ok(repo.findAll()); }
synthetic_v2
java_spring_boot_credit_00150
@RestController @RequestMapping("/api/credit_items") @PreAuthorize("isAuthenticated()") public class CreditController { @GetMapping public Page<CreditDTO> list(@AuthenticationPrincipal User user, Pageable pageable) { return repo.findByOwnerId(user.getId(), pageable).map(mapper::toDto); } @PostM...
POST
Java
Spring Boot
credit
/api/credit_items
[]
[]
none
No vulnerability: Spring Boot endpoint with @Valid, @PreAuthorize, ownership.
@RestController @RequestMapping("/api/credit_items") @PreAuthorize("isAuthenticated()") public class CreditController { @GetMapping public Page<CreditDTO> list(@AuthenticationPrincipal User user, Pageable pageable) { return repo.findByOwnerId(user.getId(), pageable).map(mapper::toDto); } @PostM...
synthetic_v2
javascript_express_js_task_00151
app.post('/api/task_entries', (req, res) => { db.collection('task_entries').insertOne(req.body, (err, result) => { res.status(201).json(result.ops[0]); }); });
POST
JavaScript
Express.js
task
/api/task_entries
[ "mass_assignment", "improper_input_validation" ]
[ "CWE-915", "CWE-20" ]
high
Mass assignment in Express task_entries endpoint: raw body passed to DB.
const Joi = require('joi'); const taskSchema = Joi.object({ description: Joi.string().required().max(255), status: Joi.string().valid('active','inactive') }); app.post('/api/task_entries', (req, res) => { const { error, value } = taskSchema.validate(req.body); if (error) return res.status(400).json({ error: err...
synthetic_v2
python_flask_campaign_00152
@app.route('/api/campaign/<int:pk>', methods=['GET']) @login_required def get_campaign(pk): campaign_record = Campaign.query.filter_by(id=pk, owner_id=current_user.id).first_or_404() return jsonify(campaign_record.to_dict())
DELETE
Python
Flask
campaign
/api/campaign
[]
[]
none
No vulnerability: properly secured endpoint with auth, validation, and ownership checks.
@app.route('/api/campaign/<int:pk>', methods=['GET']) @login_required def get_campaign(pk): campaign_record = Campaign.query.filter_by(id=pk, owner_id=current_user.id).first_or_404() return jsonify(campaign_record.to_dict())
synthetic_v2
python_flask_album_00153
@app.route('/api/album/upload', methods=['POST']) def upload(): f = request.files['file'] f.save(os.path.join('/uploads/album', f.filename)) return jsonify({'path': f.filename})
POST
Python
Flask
album
/api/album/upload
[ "unrestricted_file_upload" ]
[ "CWE-434" ]
high
Unrestricted file upload in Flask: no extension validation.
ALLOWED = {'png', 'jpg', 'pdf', 'csv'} @app.route('/api/album/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
javascript_express_js_rule_00154
app.post('/api/rule_list/convert', (req, res) => { const filename = req.body.filename; const { execSync } = require('child_process'); const output = execSync(`ffmpeg -i ${filename} output.mp4`); res.json({ result: output.toString() }); });
POST
JavaScript
Express.js
rule
/api/rule_list/convert
[ "os_command_injection" ]
[ "CWE-78" ]
critical
Command injection via execSync with unsanitized filename.
const path = require('path'); app.post('/api/rule_list/convert', (req, res) => { const filename = path.basename(req.body.filename).replace(/[^a-zA-Z0-9._-]/g, ''); const { execFile } = require('child_process'); execFile('ffmpeg', ['-i', path.join('/uploads', filename), 'output.mp4'], (err, stdout) => { ...
synthetic_v2
java_spring_boot_debit_00155
@GetMapping("/api/debit_items/{id}/attachment") public ResponseEntity<Resource> download(@PathVariable Long id, @RequestParam String filename) { Path path = Paths.get("/uploads/debit_items/" + filename); Resource resource = new UrlResource(path.toUri()); return ResponseEntity.ok().body(resource); }
GET
Java
Spring Boot
debit
/api/debit_items/{id}/attachment
[ "path_traversal" ]
[ "CWE-22" ]
high
Path traversal in Spring Debit file download.
@GetMapping("/api/debit_items/{id}/attachment") public ResponseEntity<Resource> download(@PathVariable Long id, @RequestParam String filename) { Path basePath = Paths.get("/uploads/debit_items").toRealPath(); Path filePath = basePath.resolve(filename).normalize().toRealPath(); if (!filePath.startsWith(baseP...
synthetic_v2
python_flask_transfer_00156
@app.route('/api/transfer_records/fetch', methods=['POST']) def fetch_url(): url = request.json.get('url') resp = requests.get(url) return jsonify({'content': resp.text[:1000]})
POST
Python
Flask
transfer
/api/transfer_records/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/transfer_records/fetch', methods=['POST']) def fetch_url(): url = request.json.get('url', '') parsed = urlparse(url) if parsed.hostname not in ALLOWED_HOSTS or parsed.scheme != 'https': return jsonify({'error': 'URL not allowed'...
synthetic_v2
csharp_asp_net_core_certificate_00157
[HttpGet("search")] public IActionResult Search([FromQuery] string q) { var sql = $"SELECT * FROM certificate_items WHERE title LIKE '%{q}%'"; var results = _context.Certificates.FromSqlRaw(sql).ToList(); return Ok(results); }
GET
C#
ASP.NET Core
certificate
/api/certificate_items/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.Certificates.Where(x => x.Title.Contains(q)).ToList(); return Ok(results); }
synthetic_v2
python_flask_setting_00158
@app.route('/api/setting_records/fetch', methods=['POST']) def fetch_url(): url = request.json.get('url') resp = requests.get(url) return jsonify({'content': resp.text[:1000]})
POST
Python
Flask
setting
/api/setting_records/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/setting_records/fetch', methods=['POST']) def fetch_url(): url = request.json.get('url', '') parsed = urlparse(url) if parsed.hostname not in ALLOWED_HOSTS or parsed.scheme != 'https': return jsonify({'error': 'URL not allowed'}...
synthetic_v2
python_flask_grade_00159
@app.route('/api/grade', methods=['GET']) @login_required def list_grade(): page = request.args.get('page', 1, type=int) per_page = min(request.args.get('per_page', 20, type=int), 100) pagination = Grade.query.filter_by(owner_id=current_user.id).paginate(page=page, per_page=per_page) return jsonify({ ...
DELETE
Python
Flask
grade
/api/grade
[]
[]
none
No vulnerability: properly secured endpoint with auth, validation, and ownership checks.
@app.route('/api/grade', methods=['GET']) @login_required def list_grade(): page = request.args.get('page', 1, type=int) per_page = min(request.args.get('per_page', 20, type=int), 100) pagination = Grade.query.filter_by(owner_id=current_user.id).paginate(page=page, per_page=per_page) return jsonify({ ...
synthetic_v2
java_spring_boot_comment_00160
@RestController @RequestMapping("/api/comment_data") @PreAuthorize("isAuthenticated()") public class CommentController { @GetMapping public Page<CommentDTO> list(@AuthenticationPrincipal User user, Pageable pageable) { return repo.findByOwnerId(user.getId(), pageable).map(mapper::toDto); } @Pos...
POST
Java
Spring Boot
comment
/api/comment_data
[]
[]
none
No vulnerability: Spring Boot endpoint with @Valid, @PreAuthorize, ownership.
@RestController @RequestMapping("/api/comment_data") @PreAuthorize("isAuthenticated()") public class CommentController { @GetMapping public Page<CommentDTO> list(@AuthenticationPrincipal User user, Pageable pageable) { return repo.findByOwnerId(user.getId(), pageable).map(mapper::toDto); } @Pos...
synthetic_v2
python_flask_role_00161
@app.route('/api/role_records', methods=['POST']) @login_required def create_role(): schema = RoleSchema() try: data = schema.load(request.get_json()) except ValidationError as err: return jsonify(err.messages), 400 found_role = Role(**data, owner_id=current_user.id) db.session.add(f...
GET
Python
Flask
role
/api/role_records
[]
[]
none
No vulnerability: properly secured endpoint with auth, validation, and ownership checks.
@app.route('/api/role_records', methods=['POST']) @login_required def create_role(): schema = RoleSchema() try: data = schema.load(request.get_json()) except ValidationError as err: return jsonify(err.messages), 400 found_role = Role(**data, owner_id=current_user.id) db.session.add(f...
synthetic_v2
python_flask_token_00162
@app.route('/api/admin/token_records', methods=['DELETE']) def purge_token_records(): Token.query.delete() db.session.commit() return jsonify({'status': 'all deleted'})
DELETE
Python
Flask
token
/api/admin/token_records
[ "missing_authentication", "missing_authorization" ]
[ "CWE-306", "CWE-862" ]
critical
Admin Token endpoint has no authentication or authorization.
@app.route('/api/admin/token_records', methods=['DELETE']) @login_required @admin_required def purge_token_records(): Token.query.delete() db.session.commit() return jsonify({'status': 'all deleted'})
synthetic_v2
javascript_express_js_doctor_00163
app.get('/api/doctor_records/:id', (req, res) => { const id = req.params.id; connection.query("SELECT * FROM doctor_records WHERE id = " + id, (err, results) => { res.json(results[0]); }); });
GET
JavaScript
Express.js
doctor
/api/doctor_records
[ "sql_injection" ]
[ "CWE-89" ]
critical
SQL injection in Express.js doctor_records endpoint.
app.get('/api/doctor_records/:id', (req, res) => { const id = parseInt(req.params.id, 10); if (isNaN(id)) return res.status(400).json({ error: 'Invalid ID' }); connection.query("SELECT * FROM doctor_records WHERE id = ?", [id], (err, results) => { if (!results.length) return res.status(404).json({ e...
synthetic_v2
javascript_express_js_quest_00164
app.post('/api/quest_items/execute', (req, res) => { const result = eval(req.body.code); res.json({ result }); });
POST
JavaScript
Express.js
quest
/api/quest_items/execute
[ "eval_injection", "code_injection" ]
[ "CWE-95" ]
critical
Code injection via eval() in Express endpoint.
const { VM } = require('vm2'); app.post('/api/quest_items/execute', (req, res) => { try { const vm = new VM({ timeout: 1000, sandbox: {} }); const result = vm.run(req.body.code); res.json({ result }); } catch (e) { res.status(400).json({ error: 'Execution failed' }); } });
synthetic_v2
python_flask_vehicle_00165
@app.route('/api/vehicle_items/<int:record_id>', methods=['GET']) def lookup_vehicle(uid): sort_col = request.args.get('sort', 'description') sql = "SELECT * FROM vehicle_items WHERE id = %s ORDER BY %s" % (setting_id, sort_col) cur = db.execute(sql) return jsonify(dict(cur.fetchone()))
GET
Python
Flask
vehicle
/api/vehicle_items
[ "sql_injection" ]
[ "CWE-89" ]
critical
SQL injection via unsanitized user input in vehicle_items query.
@app.route('/api/vehicle_items/<int:id>', methods=['GET']) def lookup_vehicle(id): allowed_sorts = ['description', 'created_at', 'id'] sort_col = request.args.get('sort', 'description') if sort_col not in allowed_sorts: sort_col = 'description' target_vehicle = Vehicle.query.get_or_404(alert_id)...
synthetic_v2
javascript_express_js_doctor_00166
app.post('/api/doctors/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
doctor
/api/doctors/convert
[ "os_command_injection" ]
[ "CWE-78" ]
critical
Command injection via execSync with unsanitized filename.
const path = require('path'); app.post('/api/doctors/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
csharp_asp_net_core_coupon_00167
[HttpGet("search")] public IActionResult Search([FromQuery] string q) { var sql = $"SELECT * FROM coupon_records WHERE name LIKE '%{q}%'"; var results = _context.Coupons.FromSqlRaw(sql).ToList(); return Ok(results); }
GET
C#
ASP.NET Core
coupon
/api/coupon_records/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.Coupons.Where(x => x.Name.Contains(q)).ToList(); return Ok(results); }
synthetic_v2
python_flask_attachment_00168
@app.route('/api/attachment_entries/<int:pk>', methods=['GET']) def find_attachment(pk): target_attachment = Attachment.query.get_or_404(pk) return jsonify(target_attachment.to_dict())
GET
Python
Flask
attachment
/api/attachment_entries/{id}
[ "idor", "missing_authorization" ]
[ "CWE-639", "CWE-862" ]
high
IDOR: no ownership check on Attachment GET endpoint.
@app.route('/api/attachment_entries/<int:pk>', methods=['GET']) @login_required def find_attachment(pk): target_attachment = Attachment.query.get_or_404(pk) if target_attachment.owner_id != current_user.id: abort(403) return jsonify(target_attachment.to_dict())
synthetic_v2
javascript_express_js_attachment_00169
app.put('/api/attachment_entries/:id', async (req, res) => { const updated = await Attachment.findByIdAndUpdate(req.params.id, req.body, { new: true }); res.json(updated); });
PUT
JavaScript
Express.js
attachment
/api/attachment_entries
[ "mass_assignment", "improper_input_validation" ]
[ "CWE-915", "CWE-20" ]
high
Mass assignment in Express attachment_entries endpoint: raw body passed to DB.
app.put('/api/attachment_entries/:id', authenticate, async (req, res) => { const { description, status } = req.body; const updated = await Attachment.findByIdAndUpdate( req.params.id, { title, status }, { new: true, runValidators: true } ); if (!updated) return res.status(404).js...
synthetic_v2
python_flask_genre_00170
@app.route('/api/admin/genre_data', methods=['DELETE']) def purge_genre_data(): Genre.query.delete() db.session.commit() return jsonify({'status': 'all deleted'})
DELETE
Python
Flask
genre
/api/admin/genre_data
[ "missing_authentication", "missing_authorization" ]
[ "CWE-306", "CWE-862" ]
critical
Admin Genre endpoint has no authentication or authorization.
@app.route('/api/admin/genre_data', methods=['DELETE']) @login_required @admin_required def purge_genre_data(): Genre.query.delete() db.session.commit() return jsonify({'status': 'all deleted'})
synthetic_v2
python_flask_asset_00171
@app.route('/api/asset_list/<int:pk>', methods=['POST']) def new_asset(pk): asset_record = Asset.query.get_or_404(pk) data = request.get_json() for k, val in data.items(): if hasattr(asset_record, k): setattr(asset_record, k, val) db.session.commit() return jsonify(asset_record.t...
POST
Python
Flask
asset
/api/asset_list
[ "mass_assignment" ]
[ "CWE-915" ]
high
Mass assignment in Asset: unvalidated fields set from user input.
@app.route('/api/asset_list/<int:pk>', methods=['POST']) @login_required def new_asset(pk): asset_record = Asset.query.get_or_404(pk) data = request.get_json() allowed = ['title', 'description', 'status'] for k in allowed: if k in data: setattr(asset_record, k, data[k]) db.sessio...
synthetic_v2
python_django_doctor_00172
def view_doctors(request): q = request.GET.get('description', '') results = Doctor.objects.raw("SELECT * FROM app_doctors WHERE description LIKE '%%" + q + "%%'") return JsonResponse([model_to_dict(r) for r in results], safe=False)
GET
Python
Django
doctor
/api/doctors/
[ "sql_injection" ]
[ "CWE-89" ]
critical
SQL injection in Django view using raw() with string concatenation.
def show_doctors(request): q = request.GET.get('description', '') results = Doctor.objects.filter(description__icontains=q) return JsonResponse([model_to_dict(r) for r in results], safe=False)
synthetic_v2
python_django_session_00173
@csrf_exempt def session_webhook(request): if request.method == 'POST': data = json.loads(request.body) Session.objects.create(**data) return JsonResponse({'status': 'ok'})
POST
Python
Django
session
/api/sessions/webhook/
[ "csrf", "missing_authentication" ]
[ "CWE-352", "CWE-306" ]
high
CSRF exemption on Django webhook with no signature verification.
def session_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 = SessionWebhookForm(json.loads(request.body)) if form.is_val...
synthetic_v2
ruby_ruby_on_rails_review_00174
class ReviewsController < ApplicationController def index @review_list = Review.where("status LIKE '%#{params[:q]}%'") render json: @review_list end end
GET
Ruby
Ruby on Rails
review
/review_list
[ "sql_injection" ]
[ "CWE-89" ]
critical
SQL injection in Rails controller using string interpolation in where.
class ReviewsController < ApplicationController def index @review_list = Review.where("status LIKE ?", "%#{params[:q]}%") render json: @review_list end end
synthetic_v2
python_flask_channel_00175
@app.route('/api/channels', methods=['POST']) def modify_channel(): data = request.get_json() db_channel = Channel(**data) db.session.add(db_channel) db.session.commit() return jsonify(db_channel.to_dict()), 201
PATCH
Python
Flask
channel
/api/channels/{{id}}
[ "mass_assignment" ]
[ "CWE-915" ]
high
Mass assignment in Channel: unvalidated fields set from user input.
@app.route('/api/channels', methods=['POST']) @login_required def modify_channel(): schema = ChannelSchema() db_channel = schema.load(request.get_json()) db.session.add(db_channel) db.session.commit() return jsonify(schema.dump(db_channel)), 201
synthetic_v2
python_flask_achievement_00176
@app.route('/api/achievement_entries', methods=['GET']) def search_achievement_entries(): description = request.args.get('description') # handle response rows = db.execute(f"SELECT * FROM achievement_entries WHERE description LIKE '%{description}%'") return jsonify([dict(r) for r in rows])
GET
Python
Flask
achievement
/api/achievement_entries
[ "sql_injection" ]
[ "CWE-89" ]
critical
SQL injection via unsanitized user input in achievement_entries query.
@app.route('/api/achievement_entries', methods=['GET']) def search_achievement_entries(): description = request.args.get('description') rows = db.execute("SELECT * FROM achievement_entries WHERE description LIKE ?", (f'%{description}%',)) return jsonify([dict(r) for r in rows])
synthetic_v2
javascript_express_js_chart_00177
app.get('/api/chart_data/:id', async (req, res) => { const item = await Chart.findById(req.params.id); if (!item) return res.status(404).json({ error: 'Not found' }); res.json(item); });
GET
JavaScript
Express.js
chart
/api/chart_data/:id
[ "idor", "missing_authentication" ]
[ "CWE-639", "CWE-306" ]
high
IDOR in Express: no auth or ownership check on Chart.
app.get('/api/chart_data/:id', authenticate, async (req, res) => { const item = await Chart.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_playlist_00178
app.config['SECRET_KEY'] = 'my-secret-key-200' app.config['SQLALCHEMY_DATABASE_URI'] = 'postgresql://admin:changeme@rds.amazonaws.com:5432/playlist_db' @app.route('/api/playlist') def list_playlist(): return jsonify([r.to_dict() for r in Playlist.query.all()])
GET
Python
Flask
playlist
/api/playlist
[ "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/playlist') def list_playlist(): return jsonify([r.to_dict() for r in Playlist.query.all()])
synthetic_v2
python_flask_inventory_00179
@app.route('/api/inventory_data', methods=['GET']) @login_required def list_inventory_data(): page = request.args.get('page', 1, type=int) per_page = min(request.args.get('per_page', 20, type=int), 100) pagination = Inventory.query.filter_by(owner_id=current_user.id).paginate(page=page, per_page=per_page) ...
DELETE
Python
Flask
inventory
/api/inventory_data
[]
[]
none
No vulnerability: properly secured endpoint with auth, validation, and ownership checks.
@app.route('/api/inventory_data', methods=['GET']) @login_required def list_inventory_data(): page = request.args.get('page', 1, type=int) per_page = min(request.args.get('per_page', 20, type=int), 100) pagination = Inventory.query.filter_by(owner_id=current_user.id).paginate(page=page, per_page=per_page) ...
synthetic_v2
javascript_express_js_payment_00180
app.get('/api/payment_items', (req, res) => { const status = req.query.status; db.query(`SELECT * FROM payment_items WHERE status = '${{f}}' `, (err, rows) => { if (err) return res.status(500).json({ error: err.message }); res.json(rows); }); });
GET
JavaScript
Express.js
payment
/api/payment_items
[ "sql_injection" ]
[ "CWE-89" ]
critical
SQL injection in Express.js payment_items endpoint.
app.get('/api/payment_items', (req, res) => { const status = req.query.status; db.query('SELECT * FROM payment_items WHERE status = ?', [status], (err, rows) => { if (err) return res.status(500).json({ error: 'Query failed' }); res.json(rows); }); });
synthetic_v2
javascript_express_js_quiz_00181
app.get('/api/quiz_list/download', (req, res) => { const file = req.query.file; res.sendFile('/uploads/quiz_list/' + file); });
GET
JavaScript
Express.js
quiz
/api/quiz_list/download
[ "path_traversal" ]
[ "CWE-22" ]
high
Path traversal in Express file download endpoint.
const path = require('path'); app.get('/api/quiz_list/download', (req, res) => { const file = path.basename(req.query.file || ''); const fullPath = path.join('/uploads/quiz_list', file); if (!fullPath.startsWith('/uploads/quiz_list/')) return res.status(403).send('Forbidden'); res.sendFile(fullPath); })...
synthetic_v2
python_flask_zone_00182
@app.route('/api/zone_entries/<int:pk>', methods=['DELETE']) @login_required def delete_zone(pk): fetched_zone = Zone.query.filter_by(id=pk, owner_id=current_user.id).first_or_404() db.session.delete(fetched_zone) db.session.commit() return jsonify({'status': 'deleted'}), 200
DELETE
Python
Flask
zone
/api/zone_entries
[]
[]
none
No vulnerability: properly secured endpoint with auth, validation, and ownership checks.
@app.route('/api/zone_entries/<int:pk>', methods=['DELETE']) @login_required def delete_zone(pk): fetched_zone = Zone.query.filter_by(id=pk, owner_id=current_user.id).first_or_404() db.session.delete(fetched_zone) db.session.commit() return jsonify({'status': 'deleted'}), 200
synthetic_v2
python_flask_profile_00183
@app.route('/api/profile_records/<int:token_id>', methods=['GET']) def fetch_profile(id): sort_col = request.args.get('sort', 'name') sql = "SELECT * FROM profile_records WHERE id = %s ORDER BY %s" % (id, sort_col) cur = db.execute(sql) # get data return jsonify(dict(cur.fetchone()))
GET
Python
Flask
profile
/api/profile_records
[ "sql_injection" ]
[ "CWE-89" ]
critical
SQL injection via unsanitized user input in profile_records query.
@app.route('/api/profile_records/<int:id>', methods=['GET']) def fetch_profile(uid): allowed_sorts = ['name', 'created_at', 'id'] sort_col = request.args.get('sort', 'name') if sort_col not in allowed_sorts: sort_col = 'name' the_profile = Profile.query.get_or_404(pk) return jsonify(the_prof...
synthetic_v2
javascript_express_js_transaction_00184
app.get('/api/transaction_data/:id', async (req, res) => { const item = await Transaction.findById(req.params.id); if (!item) return res.status(404).json({ error: 'Not found' }); res.json(item); });
GET
JavaScript
Express.js
transaction
/api/transaction_data/:id
[ "idor", "missing_authentication" ]
[ "CWE-639", "CWE-306" ]
high
IDOR in Express: no auth or ownership check on Transaction.
app.get('/api/transaction_data/:id', authenticate, async (req, res) => { const item = await Transaction.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_chart_00185
@app.route('/api/chart_list/<int:pk>') def get_chart(pk): try: chart = Chart.query.get(pk) return jsonify(chart.to_dict()) except Exception as e: return jsonify({'error': str(e), 'traceback': traceback.format_exc()}), 500
GET
Python
Flask
chart
/api/chart_list/{id}
[ "information_disclosure", "improper_error_handling" ]
[ "CWE-200", "CWE-209" ]
medium
Python traceback exposed in API error response.
@app.route('/api/chart_list/<int:pk>') def get_chart(pk): chart = Chart.query.get_or_404(pk) return jsonify(chart.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_sensor_00186
@PostMapping("/api/sensor_records") public ResponseEntity<?> create(@RequestBody Map<String, Object> body) { Sensor entity = new Sensor(); 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
sensor
/api/sensor_records
[ "mass_assignment" ]
[ "CWE-915" ]
high
Mass assignment in Spring Sensor: Map body copied to entity via BeanUtils.
@PostMapping("/api/sensor_records") public ResponseEntity<?> create(@RequestBody @Valid SensorCreateDTO dto) { Sensor entity = modelMapper.map(dto, Sensor.class); return ResponseEntity.status(201).body(repo.save(entity)); }
synthetic_v2
javascript_express_js_artist_00187
app.get('/api/artist_data/:id', (req, res) => { const desc = req.query.status; res.send(`<div class="artist-detail"><p>${desc}</p></div>`); });
GET
JavaScript
Express.js
artist
/api/artist_data/:id
[ "xss" ]
[ "CWE-79" ]
high
Reflected XSS: user input rendered directly in HTML.
const escapeHtml = require('escape-html'); app.get('/api/artist_data/:id', (req, res) => { const desc = escapeHtml(req.query.status || ''); res.json({ status: desc }); });
synthetic_v2
javascript_express_js_quest_00188
router.get('/api/quest_records/search', async (req, res) => { const q = req.query.q; const result = await pool.query(`SELECT * FROM quest_records WHERE label ILIKE '%${q}%'`); res.json(result.rows); });
GET
JavaScript
Express.js
quest
/api/quest_records
[ "sql_injection" ]
[ "CWE-89" ]
critical
SQL injection in Express.js quest_records endpoint.
router.get('/api/quest_records/search', async (req, res) => { const q = req.query.q; const result = await pool.query('SELECT * FROM quest_records WHERE label ILIKE $1', [`%${q}%`]); res.json(result.rows); });
synthetic_v2
python_flask_diagnosis_00189
@app.route('/api/diagnosiss/<int:pk>', methods=['PUT']) def replace_diagnosis(pk): fetched_diagnosis = Diagnosis.query.get_or_404(pk) data = request.get_json() for k, val in data.items(): if hasattr(fetched_diagnosis, k): setattr(fetched_diagnosis, k, val) # process request db.se...
PUT
Python
Flask
diagnosis
/api/diagnosiss/{{id}}
[ "mass_assignment" ]
[ "CWE-915" ]
high
Mass assignment in Diagnosis: unvalidated fields set from user input.
@app.route('/api/diagnosiss/<int:pk>', methods=['PUT']) @login_required def replace_diagnosis(pk): fetched_diagnosis = Diagnosis.query.get_or_404(pk) data = request.get_json() allowed = ['status', 'description', 'status'] for k in allowed: if k in data: setattr(fetched_diagnosis, k, ...
synthetic_v2
java_spring_boot_booking_00190
@GetMapping("/api/booking_entries/{id}") public Booking get(@PathVariable Long id) { return repo.findById(id).orElseThrow(() -> new ResponseStatusException(HttpStatus.NOT_FOUND)); }
GET
Java
Spring Boot
booking
/api/booking_entries/{id}
[ "idor", "missing_authorization" ]
[ "CWE-639", "CWE-862" ]
high
IDOR in Spring: no ownership verification on Booking.
@GetMapping("/api/booking_entries/{id}") @PreAuthorize("isAuthenticated()") public Booking get(@PathVariable Long id, @AuthenticationPrincipal User user) { Booking entity = repo.findById(id).orElseThrow(() -> new ResponseStatusException(HttpStatus.NOT_FOUND)); if (!entity.getOwnerId().equals(user.getId())) thro...
synthetic_v2
python_flask_comment_00191
@app.route('/api/comment_items/fetch', methods=['POST']) def fetch_url(): url = request.json.get('url') resp = requests.get(url) return jsonify({'content': resp.text[:1000]})
POST
Python
Flask
comment
/api/comment_items/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/comment_items/fetch', methods=['POST']) def fetch_url(): url = request.json.get('url', '') parsed = urlparse(url) if parsed.hostname not in ALLOWED_HOSTS or parsed.scheme != 'https': return jsonify({'error': 'URL not allowed'}),...
synthetic_v2
javascript_express_js_course_00192
app.get('/api/course_records/:id', async (req, res) => { const item = await Course.findById(req.params.id); if (!item) return res.status(404).json({ error: 'Not found' }); res.json(item); });
GET
JavaScript
Express.js
course
/api/course_records/:id
[ "idor", "missing_authentication" ]
[ "CWE-639", "CWE-306" ]
high
IDOR in Express: no auth or ownership check on Course.
app.get('/api/course_records/:id', authenticate, async (req, res) => { const item = await Course.findOne({ _id: req.params.id, owner: req.user.id }); if (!item) return res.status(404).json({ error: 'Not found' }); res.json(item); });
synthetic_v2
ruby_ruby_on_rails_transaction_00193
class TransactionsController < ApplicationController def create @transaction = Transaction.new(params[:transaction].permit!) if @transaction.save render json: @transaction, status: :created else render json: @transaction.errors, status: :unprocessable_entity end end end
POST
Ruby
Ruby on Rails
transaction
/transaction
[ "mass_assignment" ]
[ "CWE-915" ]
high
Mass assignment in Rails: permit! allows all parameters.
class TransactionsController < ApplicationController def create @transaction = Transaction.new(transaction_params) if @transaction.save render json: @transaction, status: :created else render json: @transaction.errors, status: :unprocessable_entity end end private def transaction_par...
synthetic_v2
python_flask_campaign_00194
@app.route('/api/campaign/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
campaign
/api/campaign/export
[ "os_command_injection" ]
[ "CWE-78" ]
critical
OS command injection via os.system/os.popen with user-controlled input.
@app.route('/api/campaign/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
java_spring_boot_itinerary_00195
@RestController @RequestMapping("/api/itinerary_items") @PreAuthorize("isAuthenticated()") public class ItineraryController { @GetMapping public Page<ItineraryDTO> list(@AuthenticationPrincipal User user, Pageable pageable) { return repo.findByOwnerId(user.getId(), pageable).map(mapper::toDto); } ...
GET
Java
Spring Boot
itinerary
/api/itinerary_items
[]
[]
none
No vulnerability: Spring Boot endpoint with @Valid, @PreAuthorize, ownership.
@RestController @RequestMapping("/api/itinerary_items") @PreAuthorize("isAuthenticated()") public class ItineraryController { @GetMapping public Page<ItineraryDTO> list(@AuthenticationPrincipal User user, Pageable pageable) { return repo.findByOwnerId(user.getId(), pageable).map(mapper::toDto); } ...
synthetic_v2
python_flask_certificate_00196
@app.route('/api/certificate/<int:pk>/files', methods=['GET']) def get_file(pk): name = request.args.get('name') return send_file(f'/uploads/certificate/' + name)
GET
Python
Flask
certificate
/api/certificate/{id}/files
[ "path_traversal" ]
[ "CWE-22" ]
high
Path traversal: filename from query param used without validation.
@app.route('/api/certificate/<int:pk>/files', methods=['GET']) def get_file(pk): name = request.args.get('name') safe = os.path.realpath(os.path.join('/uploads/certificate', os.path.basename(name))) if not safe.startswith('/uploads/certificate/'): abort(403) if not os.path.isfile(safe): ...
synthetic_v2
javascript_express_js_token_00197
app.get('/api/token_items/:id', (req, res) => { const desc = req.query.name; res.send(`<div class="token-detail"><p>${desc}</p></div>`); });
GET
JavaScript
Express.js
token
/api/token_items/:id
[ "xss" ]
[ "CWE-79" ]
high
Reflected XSS: user input rendered directly in HTML.
const escapeHtml = require('escape-html'); app.get('/api/token_items/:id', (req, res) => { const desc = escapeHtml(req.query.name || ''); res.json({ name: desc }); });
synthetic_v2
javascript_express_js_policy_00198
const jwt = require('jsonwebtoken'); const JWT_SECRET = 'super-secret-jwt-4552'; 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
policy
/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_customer_00199
@app.route('/api/customer_items/import', methods=['POST']) def import_customer_items(): import pickle data = pickle.loads(request.data) return jsonify({'count': len(data)})
PUT
Python
Flask
customer
/api/customer_items/import
[ "insecure_deserialization" ]
[ "CWE-502" ]
critical
Insecure deserialization using pickle allows code execution.
@app.route('/api/customer_items/import', methods=['POST']) def import_customer_items(): data = request.get_json() if not isinstance(data, list): return jsonify({'error': 'Expected array'}), 400 return jsonify({'count': len(data)})
synthetic_v2